homepage Welcome to WebmasterWorld Guest from 54.166.111.111
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
double padding?
ie seems to be adding double padding-top
beaudeal




msg:3139702
 1:39 pm on Oct 30, 2006 (gmt 0)

I have absolutely no clue why IE is doing this, but it appears to be adding double padding-top. I have a div tag with text inside. The code looks like this:

css
*****************************
#content {
padding: 10px;
font-size: 12px;
background-color: #fff; }
*****************************

html
*****************************
<div id="content">text goes here</div>

when this gets displayed in IE there is 20px padding top. I tried to fix it via the double margin bug, but this is not the problem.

 

collymellon




msg:3139856
 3:39 pm on Oct 30, 2006 (gmt 0)

The way I would go is:

css
*****************************
#content {
font-size: 12px;
background-color: #fff; }

.contenttext {
padding: 10px; }
*****************************

html
*****************************
<div id="content"><p class="contenttext">text goes here</p></div>

--------------------------------

When adding padding in IE onto a div it will increase the height \ width by the amount of padding you have added, when working with specific heights \ widths you can get round this by deducting the amount of padding from the size of the div.

But the above should work spot on.

beaudeal




msg:3140172
 8:14 pm on Oct 30, 2006 (gmt 0)

thanks so much for getting back, but i tried this out and it didnt work -- it produced exactly the same result. the strangest part is that it is just the padding-top. any other suggestions?

Ingolemo




msg:3140357
 11:17 pm on Oct 30, 2006 (gmt 0)

It seems to me that there must be more code involved than just the bit you've given. Could you tell us the context of that element (what are its parents, siblings, and children)?

beaudeal




msg:3140595
 3:14 am on Oct 31, 2006 (gmt 0)

i actually used the holly hack to fix it -- just added * html #content {height: 1px;}

although i've heard this is getting fixed in IE7. anyone know if thats true?

penders




msg:3140720
 7:18 am on Oct 31, 2006 (gmt 0)

When adding padding in IE onto a div it will increase the height \ width by the amount of padding you have added...

As it should do, in all standards compliant browsers (FF etc.), using a correct DOCTYPE.

But, like Ingolemo suggests, the code given in the first post is OK in itself - it renders correctly in FF, IE6 (with or without a DOCTYPE) - so the problem is possibly its interaction with other elements.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved