By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,766 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,766 IT Pros & Developers. It's quick & easy.

How to make divs reach edges of browser window?

P: n/a
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>

Jul 20 '05 #1
Share this Question
Share on Google+
18 Replies


P: n/a
puzzled wrote:
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.


body {margin:0, padding:0;}

--
William Tasso - http://WilliamTasso.com
Jul 20 '05 #2

P: n/a
in post <news:le********************************@4ax.com >
puzzled said:
If I have a div specified and want it to reach across the full width
of the browser window, it doesn't.


body{margin:0;padding:0;}

<div>100%</div>
--
brucie
Jul 20 '05 #3

P: n/a
body{margin:0;padding:0;}

+-------

Thanks people. I swear I spent three hours trying to find the answer
before posting.
Jul 20 '05 #4

P: n/a
DU
puzzled wrote:
body{margin:0;padding:0;}

+-------

Thanks people. I swear I spent three hours trying to find the answer
before posting.

Important and unknown default browser values:
http://www10.brinkster.com/doctorunc...ultValues.html

DU
Jul 20 '05 #5

P: n/a
It seems "DU" wrote in comp.infosystems.www.authoring.stylesheets in
article <bt**********@news.eusc.inter.net>:

Important and unknown default browser values:
http://www10.brinkster.com/doctorunc...ultValues.html


I guess they really _are_ unknown. I visited the above page and got
"unknow [sic] or not available" for every one except the one labeled
MSIE, which said "not available".

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #6

P: n/a
rf

"DU" <dr*******@hotREMOVETHISmail.com> wrote in message
news:bt**********@news.eusc.inter.net...
Important and unknown default browser values:

http://www10.brinkster.com/doctorunc...ultValues.html

<grin>
The daily bandwidth limit for this customer has been exceeded. Try again
after midnight, EST.
</grin>

Ah, but what EST? I'll just bet it means eastern standard USA time, not EST
Australia :-)

Cheers
Richard.
Jul 20 '05 #7

P: n/a
It seems "rf" wrote in comp.infosystems.www.authoring.stylesheets in
article <Kh****************@news-server.bigpond.net.au>:

Ah, but what EST? I'll just bet it means eastern standard USA time, not EST
Australia :-)
That's AEST not EST, according to
http://www.koalanet.com.au/wtzabb.html
Note what country hosts that page.
http://www.cisco.com/en/US/products/...0800a938e.html

seems to be a complete list. Anyone know where (or if) there's an
ISO standard list on line?

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #8

P: n/a
Stan Brown wrote:
It seems "rf" wrote in comp.infosystems.www.authoring.stylesheets in
article <Kh****************@news-server.bigpond.net.au>:

Ah, but what EST? I'll just bet it means eastern standard USA time, not EST
Australia :-)


That's AEST not EST, according to
http://www.koalanet.com.au/wtzabb.html
Note what country hosts that page.


When I lived in Sydney, the time zone was always referred to as EST.

Currently though, I am on GMT.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

Jul 20 '05 #9

P: n/a
Stan Brown wrote:
Anyone know where (or if) there's an ISO standard list on line?


Names of timezones have never been standardised, but a good
pseudo-standard might be the table in getdate.c, part of the GNU
"sh-utils" package.

The table is reproduced below, and may be distributed under the GPL.
http://www.gnu.org/copyleft/gpl.html

/* The time zone table. This table is necessarily incomplete, as time
zone abbreviations are ambiguous; e.g. Australians interpret "EST"
as Eastern time in Australia, not as US Eastern Standard Time.
You cannot rely on getdate to handle arbitrary time zone
abbreviations; use numeric abbreviations like `-0500' instead. */
static table const time_zone_table[] =
{
{ "GMT",tZONE, HOUR ( 0) },/* Greenwich Mean */
{ "UT",tZONE, HOUR ( 0) },/* Universal (Coordinated) */
{ "UTC",tZONE, HOUR ( 0) },
{ "WET",tZONE, HOUR ( 0) },/* Western European */
{ "WEST",tDAYZONE, HOUR ( 0) },/* Western European Summer */
{ "BST",tDAYZONE, HOUR ( 0) },/* British Summer */
{ "ART",tZONE, -HOUR ( 3) },/* Argentina */
{ "BRT",tZONE, -HOUR ( 3) },/* Brazil */
{ "BRST",tDAYZONE, -HOUR ( 3) },/* Brazil Summer */
{ "NST",tZONE, -(HOUR ( 3) + 30) },/* Newfoundland Standard */
{ "NDT",tDAYZONE,-(HOUR ( 3) + 30) },/* Newfoundland Daylight */
{ "AST",tZONE, -HOUR ( 4) },/* Atlantic Standard */
{ "ADT",tDAYZONE, -HOUR ( 4) },/* Atlantic Daylight */
{ "CLT",tZONE, -HOUR ( 4) },/* Chile */
{ "CLST",tDAYZONE, -HOUR ( 4) },/* Chile Summer */
{ "EST",tZONE, -HOUR ( 5) },/* Eastern Standard */
{ "EDT",tDAYZONE, -HOUR ( 5) },/* Eastern Daylight */
{ "CST",tZONE, -HOUR ( 6) },/* Central Standard */
{ "CDT",tDAYZONE, -HOUR ( 6) },/* Central Daylight */
{ "MST",tZONE, -HOUR ( 7) },/* Mountain Standard */
{ "MDT",tDAYZONE, -HOUR ( 7) },/* Mountain Daylight */
{ "PST",tZONE, -HOUR ( 8) },/* Pacific Standard */
{ "PDT",tDAYZONE, -HOUR ( 8) },/* Pacific Daylight */
{ "AKST",tZONE, -HOUR ( 9) },/* Alaska Standard */
{ "AKDT",tDAYZONE, -HOUR ( 9) },/* Alaska Daylight */
{ "HST",tZONE, -HOUR (10) },/* Hawaii Standard */
{ "HAST",tZONE, -HOUR (10) },/* Hawaii-Aleutian Standard */
{ "HADT",tDAYZONE, -HOUR (10) },/* Hawaii-Aleutian Daylight */
{ "SST",tZONE, -HOUR (12) },/* Samoa Standard */
{ "WAT",tZONE, HOUR ( 1) },/* West Africa */
{ "CET",tZONE, HOUR ( 1) },/* Central European */
{ "CEST",tDAYZONE, HOUR ( 1) },/* Central European Summer */
{ "MET",tZONE, HOUR ( 1) },/* Middle European */
{ "MEZ",tZONE, HOUR ( 1) },/* Middle European */
{ "MEST",tDAYZONE, HOUR ( 1) },/* Middle European Summer */
{ "MESZ",tDAYZONE, HOUR ( 1) },/* Middle European Summer */
{ "EET",tZONE, HOUR ( 2) },/* Eastern European */
{ "EEST",tDAYZONE, HOUR ( 2) },/* Eastern European Summer */
{ "CAT",tZONE, HOUR ( 2) },/* Central Africa */
{ "SAST",tZONE, HOUR ( 2) },/* South Africa Standard */
{ "EAT",tZONE, HOUR ( 3) },/* East Africa */
{ "MSK",tZONE, HOUR ( 3) },/* Moscow */
{ "MSD",tDAYZONE, HOUR ( 3) },/* Moscow Daylight */
{ "IST",tZONE, (HOUR ( 5) + 30) },/* India Standard */
{ "SGT",tZONE, HOUR ( 8) },/* Singapore */
{ "KST",tZONE, HOUR ( 9) },/* Korea Standard */
{ "JST",tZONE, HOUR ( 9) },/* Japan Standard */
{ "GST",tZONE, HOUR (10) },/* Guam Standard */
{ "NZST",tZONE, HOUR (12) },/* New Zealand Standard */
{ "NZDT",tDAYZONE, HOUR (12) },/* New Zealand Daylight */
{ 0, 0, 0 }
};

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

Jul 20 '05 #10

P: n/a
rf

"Stan Brown" <th************@fastmail.fm> wrote in message
news:MP************************@news.odyssey.net.. .
It seems "rf" wrote in comp.infosystems.www.authoring.stylesheets in
article <Kh****************@news-server.bigpond.net.au>:

Ah, but what EST? I'll just bet it means eastern standard USA time, not ESTAustralia :-)


That's AEST not EST, according to
http://www.koalanet.com.au/wtzabb.html
Note what country hosts that page.


Then why is not the time in New York listed in USAEST?

Over here we use EST for our time. You should use something else. EST is
*ours* :-)

Cheers
Richard.

Jul 20 '05 #11

P: n/a
rf

"Toby A Inkster" <Us******************@deadspam.com> wrote in message
news:pa****************************@goddamn.co.uk. ..
Stan Brown wrote:
Anyone know where (or if) there's an ISO standard list on line?


Names of timezones have never been standardised, but a good
pseudo-standard might be the table in getdate.c, part of the GNU
"sh-utils" package.

The table is reproduced below, and may be distributed under the GPL.
http://www.gnu.org/copyleft/gpl.html

/* The time zone table. This table is necessarily incomplete, as time
zone abbreviations are ambiguous; e.g. Australians interpret "EST"
as Eastern time in Australia, not as US Eastern Standard Time.
You cannot rely on getdate to handle arbitrary time zone
abbreviations; use numeric abbreviations like `-0500' instead. */


brucie (see his sig) use military time. It's now 13:29Kilo.

http://www.koalanet.com.au/milabb.html

<snip table which, I notice, fails to include Australia, even though it does
include those kiwis across the puddle>

Cheers
Richard.
Jul 20 '05 #12

P: n/a
While sitting in a puddle rf scribbled in the mud:
<snip table which, I notice, fails to include Australia,


K Kilo UTC +10 hours Vladivostok (Russia), Papua New Guinea, Eastern
Australia

--
Duende
Jul 20 '05 #13

P: n/a
rf wrote:
"Toby A Inkster" <Us******************@deadspam.com> wrote in message
news:pa****************************@goddamn.co.uk. ..
Names of timezones have never been standardised, but a good
pseudo-standard might be the table in getdate.c, part of the GNU
"sh-utils" package.

The table is reproduced below, and may be distributed under the GPL.
http://www.gnu.org/copyleft/gpl.html

/* The time zone table. This table is necessarily incomplete, as time
zone abbreviations are ambiguous; e.g. Australians interpret "EST"
as Eastern time in Australia, not as US Eastern Standard Time.
You cannot rely on getdate to handle arbitrary time zone
abbreviations; use numeric abbreviations like `-0500' instead. */


brucie (see his sig) use military time.


As it happens, military time is given in the table after the time zone
table in getdate.c

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

Jul 20 '05 #14

P: n/a
rf

"Duende" <xx*****@wipkip.biz> wrote in message
news:Xn******************************@130.133.1.4. ..
While sitting in a puddle rf scribbled in the mud:
<snip table which, I notice, fails to include Australia,


K Kilo UTC +10 hours Vladivostok (Russia), Papua New Guinea, Eastern
Australia


Sorry Duende, my quoting was a bit off. The table I snipped containing the
missing Australia stuff was the one posted by Toby, not the one at the URL I
quoted.

In any case K is still not adequate. Sydney and Vladivostok have
diametrically opposed views on when daylight saving operates :-)

<grin> Even brucie up in QLD runs on a different clock at the moment.
</grin>

Cheers
Richard.
Jul 20 '05 #15

P: n/a
On Wed, 14 Jan 2004 02:31:12 GMT, rf "rf" <ma**********@the.time>
declared in comp.infosystems.www.authoring.stylesheets,alt.html:

brucie (see his sig) use military time. It's now 13:29Kilo.


It's not in his sig any more. I think he changes his sig more often that
his underpants. :-)

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #16

P: n/a
rf

"Mark Parnell" <we*******@clarkecomputers.com.au> wrote in message
news:1w*******************************@40tude.net. ..
On Wed, 14 Jan 2004 02:31:12 GMT, rf "rf" <ma**********@the.time>
declared in comp.infosystems.www.authoring.stylesheets,alt.html:

brucie (see his sig) use military time. It's now 13:29Kilo.
It's not in his sig any more.


You're right.
I think he changes his sig more often that
his underpants. :-)


Maybe he read one of his own posts and suddenly found out that it was
<shudder> daytime </shudder> outside.

Cheers
Richard.
Jul 20 '05 #17

P: n/a
DU <dr*******@hotREMOVETHISmail.com> wrote in message news:<bt**********@news.eusc.inter.net>...
http://www10.brinkster.com/doctorunc...ultValues.html


That page isnt valid xhtml or css so lose the valid logos.

EC
..
Jul 20 '05 #18

P: n/a
Also sprach Stan Brown:
I guess they really _are_ unknown. I visited the above page and got
"unknow [sic] or not available" for every one except the one labeled
MSIE, which said "not available".


You have to wait a bit (= have your lunch break), then the "real" values
will show up.
Jul 20 '05 #19

This discussion thread is closed

Replies have been disabled for this discussion.