twitter bootstrap custom carousel indicators

前端 未结 2 877
暗喜
暗喜 2021-01-14 01:24

I want to change the carousel indicators with something like this:

\"custom

I ha

相关标签:
2条回答
  • 2021-01-14 02:07

    You could use media query -

    @media screen and (max-width:480px) {
         .carousel-indicators li{
            background: url(images/triangle.png) no-repeat;
            background-size:120px 60px;
            width:120px;
            height:60px;
            cursor: pointer;
            text-align:center;
        }
    
    0 讨论(0)
  • 2021-01-14 02:13

    It's collapsing because the width of your carousel-indicator is 320px. You can't have fixed with if you also want your code to be responsive on mobile. You can substitute percentage rather than using a fixed width

    .carousel-indicators li{
        background: url(images/triangle.png) no-repeat;
        max-width:25%;
        max-height:15%; /*or any other percentage that would look good*/
        cursor: pointer;
        text-align:center;
    }
    

    Note that I used max-height and max-height so that I could keep the proportion of the image so it doesn't get stretched out in either direction.

    0 讨论(0)
提交回复
热议问题