Overlay is hiding button main text and button

593 views Asked by At

I Have in an overlay with .7 opacity worked well in a carousel but when i changed browser. the overlay is in top of my main content (H1- btn ) etc .. i gave the main-content a z-index 3 and overlay a z-index 2 but when i use firefox it does work well when i go to chrome suddenly the main content is under overlay and hover wont work .now what is the best solution to fix that and make my main-content in top of the overlay

/********************************/
/*       Fade Bs-carousel       */
/********************************/
.fade-carousel {
    position: relative;
    height: 100vh;
}
.fade-carousel .carousel-inner .item {
    height: 100vh;
}
.fade-carousel .carousel-indicators > li {
    margin: 0 2px;
    background-color: #f39c12;
    border-color: #f39c12;
    opacity: .7;
}
.fade-carousel .carousel-indicators > li.active {
  width: 10px;
  height: 10px;
  opacity: 1;
}

/********************************/
/*          main-content Headers        */
/********************************/
.main-content {
    position: absolute;
    top: 60%;
    left: 50%;
    z-index: 3;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 1px 1px 0 rgba(0,0,0,.75);
      -webkit-transform: translate3d(-50%,-50%,0);
         -moz-transform: translate3d(-50%,-50%,0);
          -ms-transform: translate3d(-50%,-50%,0);
           -o-transform: translate3d(-50%,-50%,0);
              transform: translate3d(-50%,-50%,0);
}
.main-content h1 {
    color: #fed136;
    font-size: 6em;    
    font-weight: bold;
    margin: 0;
    padding: 0;
    z-index: 3;
}

.fade-carousel .carousel-inner .item .main-content {
    opacity: 0;
    -webkit-transition: 2s all ease-in-out .1s;
       -moz-transition: 2s all ease-in-out .1s; 
        -ms-transition: 2s all ease-in-out .1s; 
         -o-transition: 2s all ease-in-out .1s; 
            transition: 2s all ease-in-out .1s; 
}
.fade-carousel .carousel-inner .item.active .main-content {
    opacity: 1;
    -webkit-transition: 2s all ease-in-out .1s;
       -moz-transition: 2s all ease-in-out .1s; 
        -ms-transition: 2s all ease-in-out .1s; 
         -o-transition: 2s all ease-in-out .1s; 
            transition: 2s all ease-in-out .1s;    
}

/********************************/
/*            Overlay           */
/********************************/
.overlay {
    -moz-background-size: cover;
    -o-background-size: cover;
    -webkit-background-size: cover;
    background-position: 50% 50%; 
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-color: #080d15;
    opacity: .7;
}

/********************************/
/*          Custom Buttons      */
/********************************/
.btn.btn-lg {padding: 10px 40px;}
.btn.btn-primary {
    color: #f5f5f5;
    background-color: #fed136;
    border-color: #fed136;
    outline: none;
    margin: 20px auto;
}
.btn.btn-main-content:hover,
.btn.btn-main-content:focus {
    color: #fed136;
    background-color: transparent;
    border-color: #fed136;
    z-index: 3;
   
}

/********************************/
/*       Slides backgrounds     */
/********************************/
.fade-carousel .slides .slide-1, 
.fade-carousel .slides .slide-2,
.fade-carousel .slides .slide-3 {
  height: 100vh;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
.fade-carousel .slides .slide-1 {
  background-image: url(../img/bg-taxi03.jpg); 
}
.fade-carousel .slides .slide-2 {
  background-image: url(../img/bg-taxi04.jpg);
}
.fade-carousel .slides .slide-3 {
  background-image: url(../img/bg-taxi02.jpg);
}

/********************************/
/*          Media Queries       */
/********************************/
@media screen and (min-width: 980px){
    .main-content { width: 980px; }    
}
@media screen and (max-width: 640px){
    .main-content h1 { font-size: 4em; }    
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

 <div class="carousel fade-carousel slide" data-ride="carousel" data-interval="4000" id="bs-carousel">
                          <!-- Overlay -->
                          <div class="overlay"></div>

                          <!-- Indicators -->
                          <ol class="carousel-indicators">
                            <li data-target="#bs-carousel" data-slide-to="0" class="active"></li>
                            <li data-target="#bs-carousel" data-slide-to="1"></li>
                            <li data-target="#bs-carousel" data-slide-to="2"></li>
                          </ol>
                          
                          <!-- Wrapper for slides -->
                          <div class="carousel-inner">
                            <div class="item slides active">
                              <div class="slide-1"></div>
                              <div class="main-content">
                                
                                    <h1>TAXI EXPRESS</h1>        
                                    <h3>A reliable way to travel</h3>
                                    
                               
                                <button class="btn btn-primary btn-lg">Call US Now</button>
                              </div>
                            </div>
                            <div class="item slides">
                              <div class="slide-2"></div>
                              <div class="main-content">        
                               
                                    <h1>EXPERIENCED</h1>        
                                    <h3>Drivers On Your Sercie</h3>
                                    
                                <button class="btn btn-primary btn-lg">Check Our Chauffers</button>
                              </div>
                            </div>
                            <div class="item slides">
                              <div class="slide-3"></div>
                              <div class="main-content">        
                                
                                    <h1>Services</h1>        
                                    <h3>24 / 7 Taxi Service To Any Where Around The City</h3>
                                
                                <button class="btn btn-primary btn-lg">See Our Services</button>
                              </div>
                            </div>
                          </div> 
                    </div>

1

There are 1 answers

0
Sumesh S On BEST ANSWER

/********************************/
/*       Fade Bs-carousel       */
/********************************/
.fade-carousel {
    position: relative;
    height: 100vh;
}
.fade-carousel .carousel-inner .item {
    height: 100vh;
}
.fade-carousel .carousel-indicators > li {
    margin: 0 2px;
    background-color: #f39c12;
    border-color: #f39c12;
    opacity: .7;
}
.fade-carousel .carousel-indicators > li.active {
  width: 10px;
  height: 10px;
  opacity: 1;
}

/********************************/
/*          main-content Headers        */
/********************************/
.main-content {
    position: absolute;
    top: 60%;
    left: 50%;
    z-index: 3;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 1px 1px 0 rgba(0,0,0,.75);
      -webkit-transform: translate3d(-50%,-50%,0);
         -moz-transform: translate3d(-50%,-50%,0);
          -ms-transform: translate3d(-50%,-50%,0);
           -o-transform: translate3d(-50%,-50%,0);
              transform: translate3d(-50%,-50%,0);
}
.main-content h1 {
    color: #fed136;
    font-size: 6em;    
    font-weight: bold;
    margin: 0;
    padding: 0;
    z-index: 3;
}

.fade-carousel .carousel-inner .item .main-content {
    opacity: 0;
    -webkit-transition: 2s all ease-in-out .1s;
       -moz-transition: 2s all ease-in-out .1s; 
        -ms-transition: 2s all ease-in-out .1s; 
         -o-transition: 2s all ease-in-out .1s; 
            transition: 2s all ease-in-out .1s; 
}
.fade-carousel .carousel-inner .item.active .main-content {
    opacity: 1;
    -webkit-transition: 2s all ease-in-out .1s;
       -moz-transition: 2s all ease-in-out .1s; 
        -ms-transition: 2s all ease-in-out .1s; 
         -o-transition: 2s all ease-in-out .1s; 
            transition: 2s all ease-in-out .1s;    
}

/********************************/
/*            Overlay           */
/********************************/
.overlay {
    -moz-background-size: cover;
    -o-background-size: cover;
    -webkit-background-size: cover;
    background-position: 50% 50%; 
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-color: #080d15;
    opacity: .7;
}

/********************************/
/*          Custom Buttons      */
/********************************/
.btn.btn-lg {padding: 10px 40px;}
.btn.btn-primary {
    color: #f5f5f5;
    background-color: #fed136;
    border-color: #fed136;
    outline: none;
    margin: 20px auto;
}
.btn.btn-main-content:hover,
.btn.btn-main-content:focus {
    color: #fed136;
    background-color: transparent;
    border-color: #fed136;
    z-index: 3;
   
}

/********************************/
/*       Slides backgrounds     */
/********************************/
.fade-carousel .slides .slide-1, 
.fade-carousel .slides .slide-2,
.fade-carousel .slides .slide-3 {
  height: 100vh;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
.fade-carousel .slides .slide-1 {
  background-image: url(../img/bg-taxi03.jpg); 
}
.fade-carousel .slides .slide-2 {
  background-image: url(../img/bg-taxi04.jpg);
}
.fade-carousel .slides .slide-3 {
  background-image: url(../img/bg-taxi02.jpg);
}

/********************************/
/*          Media Queries       */
/********************************/
@media screen and (min-width: 980px){
    .main-content { width: 980px; }    
}
@media screen and (max-width: 640px){
    .main-content h1 { font-size: 4em; }    
}

.carousel-inner{
  z-index:3;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

 <div class="carousel fade-carousel slide" data-ride="carousel" data-interval="4000" id="bs-carousel">
                          <!-- Overlay -->
                          <div class="overlay"></div>

                          <!-- Indicators -->
                          <ol class="carousel-indicators">
                            <li data-target="#bs-carousel" data-slide-to="0" class="active"></li>
                            <li data-target="#bs-carousel" data-slide-to="1"></li>
                            <li data-target="#bs-carousel" data-slide-to="2"></li>
                          </ol>
                          
                          <!-- Wrapper for slides -->
                          <div class="carousel-inner">
                            <div class="item slides active">
                              <div class="slide-1"></div>
                              <div class="main-content">
                                
                                    <h1>TAXI EXPRESS</h1>        
                                    <h3>A reliable way to travel</h3>
                                    
                               
                                <button class="btn btn-primary btn-lg">Call US Now</button>
                              </div>
                            </div>
                            <div class="item slides">
                              <div class="slide-2"></div>
                              <div class="main-content">        
                               
                                    <h1>EXPERIENCED</h1>        
                                    <h3>Drivers On Your Sercie</h3>
                                    
                                <button class="btn btn-primary btn-lg">Check Our Chauffers</button>
                              </div>
                            </div>
                            <div class="item slides">
                              <div class="slide-3"></div>
                              <div class="main-content">        
                                
                                    <h1>Services</h1>        
                                    <h3>24 / 7 Taxi Service To Any Where Around The City</h3>
                                
                                <button class="btn btn-primary btn-lg">See Our Services</button>
                              </div>
                            </div>
                          </div> 
                    </div>

.carousel-inner{
  z-index:3;
}

Is this what you are looking for ?