【问题标题】:customize the carousel indicators in Bootstrap 4在 Bootstrap 4 中自定义轮播指示器
【发布时间】:2019-11-22 22:27:03
【问题描述】:

在 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;
      }

但是我不知道如何才能在指示器周围形成白色药丸状形状,以便它们始终很好地贴合在点周围。

【问题讨论】:

    标签: css twitter-bootstrap bootstrap-4


    【解决方案1】:
    .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;
    }
    

    【讨论】:

    • 谢谢!最有帮助的,我的朋友。
    猜你喜欢
    • 1970-01-01
    • 2018-12-14
    • 2018-06-26
    • 1970-01-01
    • 2016-04-20
    • 2019-06-21
    • 2013-03-28
    • 1970-01-01
    • 2019-02-28
    相关资源
    最近更新 更多