[thelist] [TIP] Solution: Zero body margin with CSS in NN4.x

Fortune Elkins fortune_elkins at summithq.com
Fri Mar 22 12:37:00 CST 2002


hiya!

>Still doesn't fix the righthand margin. There's still about a 1/4" white
space on the
>right.

you're not doing anything wrong. netscape 4 is doing it wrong! <Grin>

1-netscape 4 always leaves room on the right for a scrollbar, in case one is
required. no workaround. you're stuck, asfaik.

2-if your page is long enough to have a scrollbar already, then:

a. you have run into the situation where block elements always get
whitespace -- for nonexistent borders or whatever in netscape 4. the browser
just "reserves" space. again, you're stuck, asfaik.

b. you have a table or element that is supposed to be 100%, but netscape
just doesn't understand this and incorrectly renders. now you have hope!

in case b, some people report success by creating a wacky fake width for the
100% element. something ridiculous, like 2000px. also, try putting your
element in a <div>. give that a wacky width, and experiment with negative
margins. also try adding/removing solid borders of various widths.

of course, an easier way to do this is to use a frame. but frames are evil.
i fought with this problem for more than a week and solved it for my page
headers by doing this in a mockup for a proposed xhtml/css-p site:

#top_nav {
	background : #073771;
	layer-background-color : #073771;
	display: block;
	height : 100px;
	left : 0;
	margin : 0 -10px 0 0;
	padding : 0;
	min-width : 640px;
	position : absolute;
	top : 0;
	width : 4000px;
	border : 10px solid #073771;
	} /*wacky left position, border & background url for N4.7x*/
DIV#top_nav { left: 0; top: 0; width : 100%; height : 100px; border : 1px
outset #073771;} /* NN4.x won't recognize this */

this way i get correct positioning with IE 6, netscape 6, and Netscape 4.79.
the positions are not identical -- that is, the page doesn't look quite the
same in all the browsers -- but i do get true chrome to chrome on netscape
4.79/NT (my target). since all my pages will have scrolling, i don't have to
worry about situation #1. the weird mix of styles and their repetition (or
not) is an effort to get my target browsers to read some and ignore other
styles. it's an ugly thing. . .(if you see any improvements/simplifications
that could be made, please tell me!<Grin>)

my methods may not work for you, since with css the end result is very
dependent on the sum of all your individual styles. but i did finally get it
to happen!

you may also want to run over to al sparber's project seven site and look at
his new "layout designer" DW4 extension, which mixes styles with javascript
to get everything the way you want it across a range of browsers. this could
perhaps be of help to you.

or you may decide it's just not worth the effort.

good luck in this frustrating mission,

f


----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.




More information about the thelist mailing list