Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS resizing an image to fit the page Re: resizing an image to fit the page

#58502
calebkester
Member

The css is a linked style. if you see this line in the header:

Code:

it means the css is located here: http://css-tricks.com/examples/ImageToBackgroundImage/style.css.

If you look at the css the part that you want to keep an eye on is this:

Code:
.bg {
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 5000;
}

If you have questions on anything let me know. A quick pointer is you notice we have a z-index on this example. The reason for that is to display the image behind the weather-info (which has a z-index of 6000). If you’re having trouble with z-index remember that static styles can’t have a z-index so you need to use something else (http://css-tricks.com/absolute-relative-fixed-positioining-how-do-they-differ/).

Hope that helps!