html - Z-Index for Fixed Positioning ASP.NET -


so i've been working on webpage , i'm trying have text fixed in center of screen, once scroll down text go under other divs , un-seen. here code:

<div class="parallax">     <div class="bg__1">         <div class="absolute-center">         <span style="font-size: 50px; color: aqua">in short.</span><br />         live life @ own pace.</div>         <script>             $(document).ready(function ($) {                 var h1animation = 'animated bouncein';                 $('p').addclass(h1animation);             });         </script>     </div>     <div class="bg__2" ></div>     <div class="bg__3"></div>     <div class="bg__4"></div> </div> 

i want <div class="absolute-center"> have contents render under following divs (bg__2, bg__3, bg__4).
css code:

[class*="bg__"] {     height: 60vh;     /* fix background */     background-attachment: fixed;     /* center */     background-position: center center;     /* scale nicely element */     background-size: cover;     /* make bit better ;) */     &:nth-child(2n) {         box-shadow: inset 0 0 1em #111;     } }  .absolute-center {     width: 300px;     height: 300px;     text-align: center;     position: fixed;     top: 50%;     left: 50%;     margin-left: -150px;     margin-right: -150px; } 

i have tried adding z-index properties "bg__1" , "absolute-center", both attempts failed.

just add z-index: -1 .absolute-center. change stack level of generated box ( .absolute-center ). here can find more information on z-index property , stack order.

$(document).ready(function ($) {    var h1animation = 'animated bouncein';    $('p').addclass(h1animation);  });
[class*="bg__"] {    height: 60vh;    /* fix background */    background-attachment: fixed;    /* center */    background-position: center center;    /* scale nicely element */    background-size: cover;    /* make bit better ;) */  }    [class*="bg__"]:nth-child(2n) {    box-shadow: inset 0 0 1em #111;  }    .bg__2 {    background: url('http://placehold.it/1200x500');  }  .bg__4 {    background: url('http://placehold.it/1200x500');  }      .absolute-center {    width: 300px;    height: 300px;    text-align: center;    position: fixed;    top: 50%;    left: 50%;    margin-left: -150px;    margin-right: -150px;    z-index: -1;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  <div class="parallax">    <div class="bg__1">      <div class="absolute-center">        <span style="font-size: 50px; color: aqua">in short.</span><br />        live life @ own pace.      </div>    </div>    <div class="bg__2"></div>    <div class="bg__3"></div>    <div class="bg__4"></div>  </div>


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -