簡體   English   中英

我如何使旋轉木馬居中?

[英]How do I center my carousel?

我在這里閱讀了一些建議,並已經嘗試過,但沒有一個對我有用。 因此,我將代碼包含在此處,以查看是否有人可以將我指向正確的方向。

  1. 我想將旋轉木馬居中。
  2. 我想要一個帶有文本的輪播中的單獨容器,並且我希望該容器看起來像帶有不透明度元素或RGB(0,0,0,0.4)..元素的褪色。

HTML的

我不知道如何在沒有間距錯誤的情況下在此處發布HTML,因此我在Codepen中打開了一支筆:

https://codepen.io/mahiya-hawk/pen/YvZMbM

CSS-

* {
    margin: 0;
    padding: 0;
}
body {
    font-family: Calibri, sans-serif;
}
.background-wrap {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    top: 0;
    left: 0;
    z-index: -1000;
}
#video-bg-elem {
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    object-fit: cover;
}
.navbar{
    background-color: RGBA(0,0,0,0.2) !important;
}
#brand-image{
    height: 100px;
}
a.navbar-brand{
    position: relative;
}
.navbar-nav > li{
    margin-left:10px;
    padding: 33px 10px;
  }
.navbar-nav > li > a{
    text-decoration: none;
    font-size: 2vh;
    font-size: 2.3vw;
    font-family: 'Freestyle Script';
    font-weight: 900;
    color: rgb(210, 21, 84) !important;
    padding-bottom: 0.2%;
    display: block;
}
.navbar-nav > li:hover,
.navbar-nav > li:focus {
    background-color: RGBA(0,0,0,0.4) !important;
    transition: .9s;
}
.navbar-nav > .active > a,
.navbar-nav > .active > a:hover,
.navbar-nav > .active > a:focus {
    background-color: RGBA(0.0..0.4) !important;
}
.content {
    position: absolute;
    width: 100%;
    min-height: 100%;
}
.content h1 {
    text-align: center;
    font-size: 65px;
    text-transform: uppercase;
    font-weight: 300;
    color: #fff;
    margin-top: 5%;
    margin-bottom: 10px;
}
.content p {
    text-align: center;
    font-size: 20px;
    letter-spacing: 3px;
    color: #aaa;
}
.navbar-expand-lg .navbar-collapse {
    margin:-7px;
}
/* CUSTOMIZE THE CAROUSEL
-------------------------------------------------- */
/* Carousel base class */
.carousel {
    width: 1200px;
    margin-bottom: 480px;
}

/* Since positioning the image, we need to help out the caption */
.carousel-caption {
    z-index: 10;
}

/* Declare heights because of positioning of img element */
.carousel .item {
    height: 500px;
    background-color: #777;
}

.carousel-inner > .item > img {
    position: absolute;
    top: 0;
    left: 0;
    min-width: 100%;
    height: 480px;
}

將此規則應用於您的班級:

.carousel {
    max-width: 1200px;
    width: auto;
    margin: 0 auto 0 auto;
    text-align: center;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM