gpt4 book ai didi

html - 使用html设置轮播的宽度

转载 作者:行者123 更新时间:2023-11-27 23:09:25 25 4
gpt4 key购买 nike

我试图减小轮播的宽度,使其不会占据整个页面的宽度,但它似乎不起作用。我希望宽度仅跨越 8 列并居中。我曾尝试更改 CSS 代码,使宽度为 50% 而不是 100%,但这没有用。

.item {
height: 300px;
}

.item,
img {
height: 500px !important;
width: 100% !important;
}

.item h3 {
font-family: 'Anton', sans-serif;
font-size: 48px;
color: cornsilk;
}

.item p {
font-family: 'Anton', sans-serif;
font-size: 18px;
color: cornsilk;
}
<!--Start of carousel-->
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"> </li>
<li data-target="#carousel-example-generic" data-slide-to="1"> </li>
<li data-target="#carousel-example-generic" data-slide-to="2"> </li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="images/c1.jpg" alt="First slide" />

<div class="carousel-caption">
<h3>Welcome to my amazing website</h3>
<p3>Hope you enjoy!</p3>

</div>
</div>
<div class="item">
<img src="images/c2.jpg" alt="Second slide" />
</div>
<div class="item">
<img src="images/c3.jpg" alt="Third slide" />
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>

最佳答案

为什么不使用上层,即外部 div 元素 (id="carousel-example-generic"class="carousel slide")?

例如

.carousel{
width: 50%;
margin: 0 auto;
}

使用 bootstrap,您还可以使用包含偏移量的 bootstrap-grid:https://getbootstrap.com/docs/4.0/layout/grid/

关于html - 使用html设置轮播的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58607723/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com