我该如何设置背景图片以适应浏览器窗口的确切大小?我熟悉JavaScript/HTML/CSS/JQuery,所以任何一种语言都可以为我工作。
我该如何设置背景图片以适应浏览器窗口的确切大小?我熟悉JavaScript/HTML/CSS/JQuery,所以任何一种语言都可以为我工作。
HTML & CSS:
<html>
<head>
<title>bg</title>
<style>
.bg {
background: url(yourimage);
display: block;
position: absolute;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="bg"></div>
</body>
</html>
试试这个:
<img src="images/BG.jpg"
style="width:100%;height:100%;position:absolute;top:0;left:0;z-index:-5000;">
http://thewebthought.blogspot.com/2010/10/css-making-background-image-fit-any.html