padding

C

cosmic foo

<div style="width: 100px; padding-left: 10px; border: 1px solid
Black;">padding</div><br>
<div style="width: 100px; border: 1px black solid;">no padding</div>


firefox increases the width of the div to 110px.
ie includes the padding in the 100.

is there an easier work-around than
reducing the width by 10px if firefox?
 
R

RobG

cosmic said:
<div style="width: 100px; padding-left: 10px; border: 1px solid
Black;">padding</div><br>
<div style="width: 100px; border: 1px black solid;">no padding</div>


firefox increases the width of the div to 110px.
ie includes the padding in the 100.

is there an easier work-around than
reducing the width by 10px if firefox?

I think you should ask that question in an appropriate group:

comp.infosystems.www.authoring.stylesheets
 
V

VK

Yes there is: stop using browsers for hyperspace experiments. The outer
div has width 100px and left padding 10px. The math tells us that you
have 90px of available width inside. And you insert there another div
of 100px width.

This leaves the browser with two options only:
1) Transpode your div's into Riemann Space to accomodate both oblect on
the n-dimentional sphere.
2) Stay in the conventional Euclidean Space and change the size of one
of div's.

Strangely enough browsers prefer the Euclidean Space. You may file a
complain about it if you want. But if would be much simplier to use
realistic sizes.

And really <comp.infosystems.www.authoring.stylesheets> is the place to
put such questions.
Or <sci.math> if the hyperspace is really calling for you...
 
M

Michael Winter

On 26/07/2005 01:14, VK wrote:

[Quoting levels adjusted]

You need to be careful here: Firefox does nothing to the width. It is
the 100 pixels you requested. However, the box that completely contains
the element has been expanded by ten pixels of padding, and this is what
should happen.

Clearly, your document must be rendered in Quirks mode, or the IE
version you're looking at is prior to 6.

Microsoft used a box model that was different than the one specified by
the W3C wherein the padding and borders of an element were considered to
be part of the width of that element, whereas CSS considers these to be
external and the width property refers solely to the content.

Place your document into Standards mode by including a complete DOCTYPE
declaration and fix your style sheet. If you need (or want) to support
IE5.5 and earlier, you'll also want to read up on the "Box Model bug"
and it's solutions.
Yes there is: stop using browsers for hyperspace experiments. The outer
div has width 100px and left padding 10px. The math tells us that you
have 90px of available width inside.

No, it doesn't. Perhaps you should read a CSS specification (any of them
will do).

[snipped usual rubbish]

Mike
 
C

cosmic foo

Michael Winter said:
On 26/07/2005 01:14, VK wrote:

[Quoting levels adjusted]

You need to be careful here: Firefox does nothing to the width. It is
the 100 pixels you requested. However, the box that completely contains
the element has been expanded by ten pixels of padding, and this is what
should happen.

Clearly, your document must be rendered in Quirks mode, or the IE
version you're looking at is prior to 6.

Microsoft used a box model that was different than the one specified by
the W3C wherein the padding and borders of an element were considered to
be part of the width of that element, whereas CSS considers these to be
external and the width property refers solely to the content.

Place your document into Standards mode by including a complete DOCTYPE
declaration and fix your style sheet. If you need (or want) to support
IE5.5 and earlier, you'll also want to read up on the "Box Model bug"
and it's solutions.
Yes there is: stop using browsers for hyperspace experiments. The outer
div has width 100px and left padding 10px. The math tells us that you
have 90px of available width inside.

No, it doesn't. Perhaps you should read a CSS specification (any of them
will do).

[snipped usual rubbish]

Mike


thanks.
 
G

Grant Wagner

Michael Winter said:
No, it doesn't. Perhaps you should read a CSS specification (any of
them will do).

If you don't want a simple to understand explanation of the box models
used by IE (in Quirks mode or prior to version 6) and other browsers,
and ways of designing CSS to circumvent those diffferences, check out
<url:
http://www.communitymx.com/content/article.cfm?page=1&cid=E0989953B6F20B41
/>.

I'm not endorsing their techniques, but I found the explanation of the
box model more informative than trying to read and understand the CSS
specification.
 

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

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top