I am currently using this:
HTML:
<div id="container"> <img src="x.jpg" id="bg" /> <div id="content"> <h1>Welcome to my website.</h1> <p>Boo!</p> </div> </div>
CSS
#bg{ position:absolute; top:0; left:0; height:100%; z-index:10; } #container{ max-width:1200px; max-height:800px; } #content{ position:absolute; top:10px; left:100px; z-index:100; }
The advantage is that I don't use Javascript at all. But then absolute positioned elements become a nightmare when viewed on different screens.
Currently, the solution I have is to record and place these elements according to different screen sizes (for example, 1024x768 will have the top id value as 10px, while 1280x800 will have something like top: 25px, etc. etc.) and save them as a separate css file so that I can load the appropriate CSS while the page is loading. I believe this is time consuming and probably inefficient. Using percentages is an option that I have not yet explored. If you know about the elegant solution or how the big guys at about.me do this, it will help.
Thanks.
source share