P
puzzled
I have looked and looked and not found the answer to this one - just
lots of references to this or that "hack" that is supposed to fix the
problem (and it is a problem to some people).
If I have a div specified and want it to reach across the full width
of the browser window, it doesn't. There is an approximately 10-pixel
margin on either end of the div. I can "fix" this by setting my left
and right margins to -10px, but by doing so, I get the feeling that
I'm doing something that was never intended.
So first, why DON'T div's naturally, as far as I can tell, touch the
edges of the browser window. And second, what is the right/best/
least worst/"correct" way to make them touch the browser window edges.
See the following html:
<html>
<head>
<style type="text/css">
<!--
..bluearea {
margin: 0px;
padding: 5px;
width: auto;
color: white;
background-color: blue;
}
..redarea {
margin-left: -10px;
margin-right: -10px;
padding: 5px;
width: auto;
color: white;
background-color: red;
}
-->
</style>
</head>
<body>
<div class="bluearea">
Why does this blue band not touch the edges of the browser window?
</div>
<div class="redarea">
While this red band does?
</div>
</body>
</html>
lots of references to this or that "hack" that is supposed to fix the
problem (and it is a problem to some people).
If I have a div specified and want it to reach across the full width
of the browser window, it doesn't. There is an approximately 10-pixel
margin on either end of the div. I can "fix" this by setting my left
and right margins to -10px, but by doing so, I get the feeling that
I'm doing something that was never intended.
So first, why DON'T div's naturally, as far as I can tell, touch the
edges of the browser window. And second, what is the right/best/
least worst/"correct" way to make them touch the browser window edges.
See the following html:
<html>
<head>
<style type="text/css">
<!--
..bluearea {
margin: 0px;
padding: 5px;
width: auto;
color: white;
background-color: blue;
}
..redarea {
margin-left: -10px;
margin-right: -10px;
padding: 5px;
width: auto;
color: white;
background-color: red;
}
-->
</style>
</head>
<body>
<div class="bluearea">
Why does this blue band not touch the edges of the browser window?
</div>
<div class="redarea">
While this red band does?
</div>
</body>
</html>