box model, how to solve trouble?

X

X t l a n

Hello.

I wonder, how do you cope with problem of box model arising from quirks
mode and full css compatibility mode? I mean situation, when there is
container, let me say e.g.:
<div style="position:absolute; top:20px;left:20px; height:100px;
width:100px; margin: 3px solid grey></div>

-w3c model says width dimensions doesn't cover margins
-ie model says that width includes margin dimensions as well

How to prepare one stylesheet or/and separate styleshets separately for
ie (quirks mode browsers) and for mozilla (full css compatibility mode
browsers) to provide the same dimensions of container on the assumption
that I want use margin values >0px.

Best regards.
 
T

Tonnie

X said:
Hello.

I wonder, how do you cope with problem of box model arising from quirks
mode and full css compatibility mode? I mean situation, when there is
container, let me say e.g.:
<div style="position:absolute; top:20px;left:20px; height:100px;
width:100px; margin: 3px solid grey></div>

-w3c model says width dimensions doesn't cover margins
-ie model says that width includes margin dimensions as well

How to prepare one stylesheet or/and separate styleshets separately for
ie (quirks mode browsers) and for mozilla (full css compatibility mode
browsers) to provide the same dimensions of container on the assumption
that I want use margin values >0px.

Hi Xtlan,

Instead of using the margin on the absolute positioned element you could
place it on a containing element. It usually should fix the problem.

<div style="position:absolute; top:20px;left:20px; height:100px;
width:100px;">
<div style="margin: 3px solid grey;"></div>
</div>

Not tested.


Greetings,

Tonnie
 
J

Jonathan N. Little

Tonnie wrote:
<div style="margin: 3px solid grey;"></div>
^ ^
Also this is not valid for margins, now borders can have 'style' and
'color'.
 
T

Tonnie

Jonathan said:
Tonnie wrote:


^ ^
Also this is not valid for margins, now borders can have 'style' and
'color'.

Yepp you are right, copy and pasted the whole thing and forgot to remove
the solid grey. :(
 

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,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top