widths in Netscape/Mozilla

J

James Yu

When I specify a width in css for a box, Netscape renders the box with a
width of "width + padding". I want Netscape to just consider the absolute
width of the box, and not take padding into account at all. Are there any
work arounds? This is inconsistent with IE. Or am I missing something?

Thanks,
James
 
T

Toby A Inkster

James said:
When I specify a width in css for a box, Netscape renders the box with a
width of "width + padding". I want Netscape to just consider the absolute
width of the box, and not take padding into account at all. Are there any
work arounds? This is inconsistent with IE. Or am I missing something?

Netscape does it the right way. Most other browsers do too. The width of
a rendered element should be:

'border-left' + 'padding-left' + 'width' + 'padding-right' + 'border-right'

And the amount of space that it takes up should be:

'margin-left' + 'Rendered Width (as above)' + 'margin-right'

Netscape, Opera, Konqueror, Safari all get this right. IE5 gets this
wrong. IE6 can be told to get it right though. How? By setting a DOCTYPE.
How? As the first line of your HTML, include this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top