Search code examples
htmlbackgroundborderfixed

How to make an image static when scrolling


So I have a border at the top of the page and I want it to stay in the same spot when I scroll down. I've tried putting position: fixed in many different spots and still can't make it work. Also, I would like the other content to scroll behind this image if possible. This is my code:

    <div style='
      background-image: url(http://i111.photobucket.com/albums/n144/baby_painting/bowlace2.gif);
      background-repeat: repeat-x;'>
         <img src="http://i111.photobucket.com/albums/n144/baby_painting/bowlace2.gif">
    </div>

it's for the page nikkidarlinggg.tumblr.com sorry If I'm not typing this correctly, I've never used this site before.


Solution

  • Add these styles to the div:

    position: fixed;
    width: 100%;
    z-index: 10;