css - 在 Bootstrap 4 中自定义轮播指示器
问题描述
在 Bootstrap 4 中,我有一个带有两张幻灯片的轮播。我想自定义轮播指示器。
作为我想使用点的形状,活动点的颜色应该是红色,非活动点的颜色应该是黑色。这两个点应该被一个白色药丸状的形状包围,以从灰色背景中脱颖而出。
它应该如下所示:
我设法根据答案https://stackoverflow.com/a/47235368/3384674以及颜色更改了指标的形状:
.carousel-indicators li {
width: 10px;
height: 10px;
border-radius: 100%;
background-color: black;
opacity: 1;
}
.carousel-indicators li.active {
background-color: red;
}
但是我不知道如何在指示器周围获得白色药丸状形状,以便它们始终很好地贴合在点周围。
解决方案
.carousel-indicators{
max-width: 120px;
margin-left: auto;
margin-right: auto;
background: #fff;
border-radius: 25px;
padding: 8px;
align-items: center;
}
.carousel-indicators li{
width: 20px;
height: 20px;
border-radius: 100%;
background: black;
opacity: 1;
border: 0;
}
.carousel-indicators li.active {
background-color: red;
}
推荐阅读
- javascript - 我正在尝试获取与 Invoiceline 实体链接的 Invoices 实体,但没有得到任何结果
- android - Unity3d Admob 集成中断了 Android 构建:“D8:程序类型已经存在:android.support.customtabs.ICustomTabsCallback”
- css - 如何在 CSS 中使用背景图像平滑地无限放大和缩小
- r - 如何计算某个变量的每个观察值的负值数量
- ios - 如何每天更新标签文本,以便用户每天获得另一个预定义文本?
- c - 如何在列表(C)的每个节点之前插入一个数字?
- data-visualization - 通过 ARKit 在 AR 中使用数据可视化
- mysql - 外键约束格式不正确(MySQL)
- android - 使用 Android camera2 API,是否可以保持曝光和帧率恒定,但自动设置灵敏度/增益?
- assertj - 在测试 Streams 的供应商时我可以避免强制转换吗