/ Published in: CSS
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* css */ #bg { position:fixed; top:-50%; left:-50%; width:200%; height:200%; } #bg img { position:absolute; top:0; left:0; right:0; bottom:0; margin:auto; min-width:50%; min-height:50%; } /* html */ <div id="bg"> <img src="images/background.jpg" alt="Background Image" /> </div>