Home  |  About  | Last |  Submit  |  Contact
AllQuests.com

Previous Question:  Problems with External CSS in IE5  CSSNext Question:  Child DIV Styles based on Partent DIVs style  CSS

Question Borders Padding in different browsers ( SitePoint Forums CSS )
Updated: 2008-11-23 03:55:01 (2)
Borders Padding in different browsers

I've noticed that different browsers work with borders and padding differently, but I can't figure out exactly how.

It seems that in IE if you create a div with a specified width and then add a border or padding, the width of the div will not change.

When working with Firefox though, any padding/borders seems to be added to the width specified.

Due to these difference I'm having trouble getting designs with borders and padding to work out properly. Can someone please explain how the browsers handle these, and how to make it work for both?

Answers: Borders Padding in different browsers ( SitePoint Forums CSS )
Borders Padding in different browsers

http://tantek.com/CSS/Examples/boxmodelhack.html

The link above explains the CSS box model (basically, IE is getting it wrong while Firefox is getting it right). There are various workarounds (one is presented on the page).

vgarcia

Borders Padding in different browsers

If you avoid specifying padding and borders at the same time as defining width you can avoid the box model problem some of the time.

Apply the padding and borders to inner elements(where possible) will avoid the problem altogether.

Or as Vinnie pointed out use one of the hacks such as the tantek hack above, or my favourite because its easier to remember and only affects ie is linked to below.

http://www.info.com.ph/~etan/w3panth...ifiedsbmh.html

Also read the FAQ sticky thread at the top of the css forum as the first faq explains the problem indetail

Paul

Paul O'B

Previous Question:  Problems with External CSS in IE5  SitePoint Forums  CSSNext Question:  Child DIV Styles based on Partent DIVs style  SitePoint Forums  CSS

- Source: Borders Padding in different browsers SitePoint Forums CSS
- Previous Question: Problems with External CSS in IE5 SitePoint Forums CSS
- Next Question: Child DIV Styles based on Partent DIVs style SitePoint Forums CSS





AllQuests.com


Best dedicated servers   Top dedicated servers   Cheap dedicated servers   Linux dedicated servers   Windows dedicated servers   Unmetered dedicated servers