4

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.

2

4 Answers 4

2

Thanks to @Nelson 's comment I have found my answer here: http://css-tricks.com/perfect-full-page-background-image/

Sign up to request clarification or add additional context in comments.

Comments

0

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>

Comments

0

I've used the Backstretch jQuery plugin for this before.

http://srobbin.com/jquery-plugins/backstretch/

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.