Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap carousel indicators are square; I want them round

Tags:

html

css

I have just successfully set up a 3-image carousel on my site using Bootstrap. This is what it looks like:

enter image description here

If you notice, the indicators are square and I want them to be round! All the tutorials I have followed thus far seem to get it right; I have never seen anyone else's carousel with square indicators. Here's my HTML:

<!-- Carousel start -->
<div id="myCarousel" class="carousel slide">
  <ol 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>
  </ol>
  <div class="carousel-inner">
    <div class="item active">
      <img src="bootstrap/img/home-page-banner.jpg"/>
      <div class="container">
        <div class="carousel-caption">
          <h1>Heading One</h1>
          <p>Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum </p>
          <p><a class="btn btn-large btn-primary">Sign up!</a></p>
        </div>
      </div>
    </div>
    <div class="item">
      <img src="bootstrap/img/home-page-banner.jpg"/>
      <div class="container">
        <div class="carousel-caption">
          <h1>Heading One</h1>
          <p>Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum </p>
          <p><a class="btn btn-large btn-primary">Sign up!</a></p>
        </div>
      </div>
    </div>
    <div class="item">
      <img src="bootstrap/img/home-page-banner.jpg"/>
      <div class="container">
        <div class="carousel-caption">
          <h1>Heading One</h1>
          <p>Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum </p>
          <p><a class="btn btn-large btn-primary">Sign up!</a></p>
        </div>
      </div>
    </div>
  </div>
  <a class="left carousel-control" href="#myCarousel" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left"></span>
  </a>
  <a class="right carousel-control" href="#myCarousel" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right"></span>
  </a>
</div>
<!-- Carousel end -->

What do you think I am going wrong with here? Is there any class I should be using with the carousel-indicators <ol> that I am not aware of yet?

P.s.: I have already tried .carousel-indicators { border-radius: 100%;} with no success.

like image 264
TheLearner Avatar asked Sep 08 '15 18:09

TheLearner


People also ask

How do you change the shape of carousel indicators?

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% .

How do you change the interval on carousel?

You can simply use the data-interval attribute of the carousel class. It's default value is set to data-interval="3000" i.e 3seconds. All you need to do is set it to your desired requirements.


1 Answers

Add border-radius:

.carousel-indicators > li {
  border-radius: 50%;
}

Note that you have to target the li tags within the carousel-indicators class and also do 50% not 100%.

So you don't have to use !important to override the default border-radius:

#myCarousel-indicators > li {
  border-radius: 50%;
}

<ol id="myCarousel-indicators" class="carousel-indicators"></ol>
like image 135
Chrillewoodz Avatar answered Nov 10 '22 01:11

Chrillewoodz