gpt4 book ai didi

html - 旋转木马指示器 bootstrap 4 不采用 css 样式

转载 作者:太空宇宙 更新时间:2023-11-04 06:36:28 25 4
gpt4 key购买 nike

我正在尝试像下图那样设置 bootstrap 4 轮播指示器的样式,但我无法这样做。

enter image description here

.carousel-indicators {
width: auto;
padding: 8px 18px;
background-color: rgba(96,107,114,.8);
border-radius: 18px;
line-height: 0;

}


.carousel-indicators li {
border-radius: 50% !important;
width: 12px;
height: 12px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">


<ul class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ul>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

在我的例子中,背景的宽度更大。我尝试过定位和翻译但无法这样做。我无法像上图那样实现。谁能帮我解决这个问题。

最佳答案

您可以使用 !important 使其工作。这是必需的,因为它需要覆盖 Bootstrap 的样式。

强烈建议不要使用此方法。我建议您使用 Bootstrap Sass 来生成您需要的 css。您有变量来定义 _variables 文件中的样式。


好的,我在回答之前没有阅读完整的问题。您还需要覆盖一些默认的 Bootstrap 类以获得类似的指示器。

.carousel-indicators {
/* required to override bootstrap */
right: unset !important;
left: unset !important;
padding-left: 18px !important;
margin-right: unset !important;
margin-left: unset !important;
/* your css styles */
width: auto;
padding: 8px 18px;
background-color: rgba(96, 107, 114, .8);
border-radius: 18px;
line-height: 0;
}

.carousel-indicators li {
border-radius: 50% !important;
width: 12px !important;
height: 12px !important;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<div class="row no-gutters justify-content-center">
<ul class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ul>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

关于html - 旋转木马指示器 bootstrap 4 不采用 css 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54178548/

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