Forum Moderators: not2easy
<div id="text" style="position:absolute; width:380px; height:92px; z-index:1; background-color: #FFFFFF; background-color: #FFFFFF; overflow: auto; padding-left: 5px;">
Are you saying the padding inside the box is different than in IE? If so, then it's possible you are using IEs broken box model. What doctype are you using?
The Box Model [w3.org]
How to pad just what's inside the DIV without affecting anything else?
<p>Don't style this paragraph... leave as default</p>
<div id="mydiv">
<p>Pad and style this paragraph</p>
<p>... and this one too.</p>
</div>
div#mydiv p {
padding:1em;
font-size:larger;
color:#f00;
}
This will pad (and style) just the <p> tags that are within the div id="mydiv"
To contain collapsing margins consistently x-browser in non-positioned elements, usually all that's needed is to add 1px top/bottom padding to the div (or a top/bottom border) - this stops the div margin adjoining with the elements inside it, and stops any collapsing
In all cases, especially floated and positioned elements thi above might not be enough for IE because it sometimes collapses them entirely, to goodness knows where!
(this is what's happening using the example above I think, not sure as I don't know what was inside it)
Rule of thumb for IE, don't rely on the default margins of the <p>, <hx>, <ul>, <form> elements (any really) inside the div, explicitly give them margins.. e.g. p {margin: 1em 0;}
try this for example of difference, then uncomment the p margin to see IE come into line with FF, if you then don't want a top gap you can just remove the margin from the top paragraph.
longwinded perhaps, but a least you know what's generating the "gap" and IE should be generating one too ;)
<style type="text/css" media="screen">
#text {
position:absolute;
top: 0;
left: 0;
width:380px;
height:92px;
background-color: #eee;
padding-left: 5px;
}/*p {margin: 1em 0;}*/
/*p.topp {margin-top: 0;}*/
</style>
</head>
<body>
<div id="text">
<p class="topp">some text here</p>
<p>some text here</p>
</div>
[edited by: SuzyUK at 7:59 am (utc) on Sep. 19, 2006]