How can I set the background image to fit the exact size of the browser's window. I am familiar with JavaScript/HTML/CSS/JQuery so any language will work for me.
感谢@Nelson的评论,我在这里找到了答案: http ://css-tricks.com/perfect-full-page-background-image/
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>
I've used the Backstretch jQuery plugin for this before.
Try this:
<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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.