Jump to content

How to stretch a DIV to full width of browser ?


Recommended Posts

I cant see the image link but it is probably just the page margins (by default I think it is 10px) which would stop the div stretching right across the page. If you are using Dreamweaver just go into Page Properties and set the margins to 0px. Or put this:

 

<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>

 

In your page head.

  • 4 weeks later...

I cant see the image link but it is probably just the page margins (by default I think it is 10px) which would stop the div stretching right across the page. If you are using Dreamweaver just go into Page Properties and set the margins to 0px. Or put this:

 

<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>

 

In your page head.

 

i tried but problem is remain there.. any other solution?

His code should work, however you can do the same with  margin: 0px;

You have to place your footer at the whole bottom of your code. It could be that you placed it in another div or table and has invisible borders or other padding and or margin settings.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Title</title>
</head>
<body>
<style type="text/css">
<!--
body {
   margin: 0px;
}
-->
</style>

//place this on a single line, just in front of your </body>
<img src="footer.gif" width="100%" height="200" />
</body>
</html>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.