Bootstrap 4 - change the carousel indicators into dots

前端 未结 3 1159
醉梦人生
醉梦人生 2021-02-01 18:53

I am using Bootstrap 4 Beta 2 version to do a carousel. The code looks like below:

                
相关标签:
3条回答
  • 2021-02-01 19:40

    I had to include .carousel for it to work properly.

    .carousel .carousel-indicators li {
       width: 10px;
      height: 10px;
      border-radius: 100%;
    }
    
    0 讨论(0)
  • 2021-02-01 19:45

    Yes, I think you need to write custom CSS for doing lines into dots.
    You just need to override two properties (width and height) and add a new one, border-radius, to .carousel-indicators li.
    Make width and height values equal eg: 10px each and give a border-radius of 100%.

    .carousel-indicators li {
      width: 10px;
      height: 10px;
      border-radius: 100%;
    }
    
    0 讨论(0)
  • 2021-02-01 19:53

    You just need to change the icon path in case you have one, using the inspect element you can get the class name. I used Mozilla to get the class name and then I used two svg icons for changing the default icons to custom icons.

    .carousel-control-prev-icon {
    
        background-image: url("images/carousel/back.svg");
    
    }
    
    .carousel-control-next-icon {
    
        background-image: url("images/carousel/next.svg");
    
    }
    
    0 讨论(0)
提交回复
热议问题