Box model hack
Discussion
Just want to confirm something regarding the box model hack.
I have a table cell that needs to fit into a 240 px wide space. I want it to have 10px padding to the left and right.
My HTML is as follows:
...and the associated css file:
td.td240pxBox
{
width:218px;
border:1px solid gray;
padding:10px 10px;
}
td.td240pxBox
{
width:240px;
voice-family: "\"}\"";
voice-family:inherit;
width:218px;
}
Is this correct? Does it mean that in IE5.5+ and FF the "content" area of the cell will be 218px, border of 1px each side, padding of 10px each side, making the max width 240px?
Cheers.
ETA: It is tabular data I am displaying, so I'm not going to go purely css...
I have a table cell that needs to fit into a 240 px wide space. I want it to have 10px padding to the left and right.
My HTML is as follows:
<table width="240">
<tr>
<td class="td240pxBox">Some content here</td>
</tr>
</table>
...and the associated css file:
td.td240pxBox
{
width:218px;
border:1px solid gray;
padding:10px 10px;
}
td.td240pxBox
{
width:240px;
voice-family: "\"}\"";
voice-family:inherit;
width:218px;
}
Is this correct? Does it mean that in IE5.5+ and FF the "content" area of the cell will be 218px, border of 1px each side, padding of 10px each side, making the max width 240px?
Cheers.
ETA: It is tabular data I am displaying, so I'm not going to go purely css...
Edited by incubus on Thursday 11th October 17:07
why not just use a nice pretty div?
<div id="240box">
<p>wangs</p>
</div>
}
}
should be padded all round and work in both bowsers?
(not that i've checked..)
edit: hash's dont work here, so 'quote' me to see it properly
<div id="240box">
<p>wangs</p>
</div>
- 240box{
}
- 240box p{
}
should be padded all round and work in both bowsers?
(not that i've checked..)
edit: hash's dont work here, so 'quote' me to see it properly
Edited by Altrezia on Friday 12th October 09:38
CSS hacks on the whole tend not to be effective since the introduction of IE7. Hacks rely on browser bugs, which IE7 doesn't suffer from to the degree of previous IE versions, but unfortunately it's still not nearly as capable and standards compliant as browsers such as Mozilla and Opera.
You're much better of using conditional comments to load styles for particular IE versions separately (ee www.quirksmode.org/css/condcom.html for more info on conditional comments).
Using conditional comments, you could have a style rule specifically for this table cell class specifially for IE6.
You're much better of using conditional comments to load styles for particular IE versions separately (ee www.quirksmode.org/css/condcom.html for more info on conditional comments).
Using conditional comments, you could have a style rule specifically for this table cell class specifially for IE6.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff



