我想在 div 和表格中放置一个覆盖整个窗口和内容的拉伸背景图像。
此代码工作正常:
<!doctype html> <html> <head> <title>Background to fit screen</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Imagetoolbar" content="no"> <style type="text/css"> /* pushes the page to the full capacity of the viewing area */ html {height:100%;} body {height:100%; margin:0; padding:0;} /* prepares the background image to full capacity of the viewing area */ #bg {position:fixed; top:0; left:0; width:100%; height:100%;} /* places the content ontop of the background image */ #content {position:relative; z-index:1;} </style> </head> <body> <div id="bg"><img src="../images/background.jpg" width="100%" height="100%" alt=""></div> <div id="content"> <table> <tr> <td> <img src="images/1.jpg"> </td> <td> <img src="images/2.jpg"> </td> </tr> </table> </div> </body> </html>
问题是表格单元格中图像之间的间距!一旦你有一张非常大的桌子,里面有大量的图像,那就太糟糕了。
请帮忙!