/ Published in: CSS
Expand |
Embed | Plain Text
<html> <title>CSS Background Stretch</title> <head> <!-- Below is the CSS code --> <style type="text/css"> html, body {height:100%; margin:0; padding:0;} #page-background {position:fixed; top:0; left:0; width:100%; height:100%;} #content {position:relative; z-index:1; padding:10px;} </style> <!-- The above code works for all browser except IE so we are going to specify another special style sheet for IE6 to make the whole code cross browser compatible --> <!--[if IE 6]> <style type="text/css"> html {overflow-y:hidden;} body {overflow-y:auto;} #page-background {position:absolute; z-index:-1;} #content {position:static;padding:10px;} </style> <![endif]--> </head> <body> <--! HERE IS THE HTML CODE NEEDED--> <div id="page-background"><img src="background.jpg" width="100%" height="100%"></div> <div id="content"> You site's content </div> </body> </html>
You need to login to post a comment.
