0

I want to add text over an image using css. I am using bootstrap. I have not to use background image.

 <div id="myCarousal" class="carousal slide">
            <div class="carousal-inner"> 
            <div class="item active"> 
              <img src="img/cr1.jpg">
                <div class="container active">
                  <div class="carousal-caption"> 
                  <h1>  Quiz </h1>
                  <p> Want to be part of it..</p>

                  <p> <a href="#" class="btn btn-primary btn-large">Sign Up Today</a></p>

                  </div>
                </div>
            </div>
            </div>
          </div>

The CSS is as follows..

.carousel-caption{
    z-index:10;
    position: absolute; 
   top: 200px; 
   left: 0; 
   width: 100%; 
}
.carousel-inner > .item > img{
    position: relative;
    top: 50px;
    /*left: 0;*/
    min-width: 100%;
    height: auto;
}
.carousel-inner > .item{
    height: 500px;   
}

Please help me to fix it.

jahan
  • 521
  • 1
  • 4
  • 15

1 Answers1

0

Try adding z-indexes for each element. Just in case, we're adding a z-index for everything inside .carousel-caption just to avoid any chance you have some z-index somewhere

.carousel-inner .item img{
    position: relative;
    top: 50px;
    /*left: 0;*/
    min-width: 100%;
    height: auto;
    z-index:0;
}
.carousel-caption{
    z-index:1;
    position: absolute; 
   top: 200px; 
   left: 0; 
   width: 100%; 
}
.carousel-caption *{
    z-index:1000;
    position: relative;
}
Devin
  • 7,690
  • 6
  • 39
  • 54