html - Content Scrolls over image -


so have image isn't set background, takes entire width , of height. want image remain in it's position , user scrolls, content below scrolls on top of image.

i tried using:

position: fixed; z-index: -1; /* or value */ 

but neither or worked.

what have without position or z-index applied: https://jsfiddle.net/hhcvmrfx/

i want div container appear under image , overlap image when user scrolls.

to overlap container below when user scrolls down, you'll need set padding-top value, parent .container, equal or less height of fixed image in question.
apply background colour nested div element instead.

body {    padding: 0;    margin: 0;    background-color: #f7f7f7;    overflow-x: hidden;  }    /* images */  #head-banner-img {    border-bottom: 5px solid #222222;    position: fixed;  }    /* container content */  .container {      width: 100%;      height: 500px;      background-color: transparent;      padding-top: 947px;      font-size: 30px;      text-align: center;      position: relative;  }    .container > div {      background: #2c2c2c;      height: 100%;      padding: 50px;      box-sizing: border-box;      color: white;  }
<img src="http://www.thestoryboardz.com/images/background.jpg" alt="munch banner" id="head-banner-img">      <div class="container">        <div>hello</div>      </div>


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo