When I divide page into columns using tags by passing width values in percentages, that is I declare the body’s div width as 100% inside which two div’s are declared as 20% & 80% width, it’s working fine in IE8, but not in firefox unless I change the second width from 80% to 79%. Can u pls explain why?
When I divide page into columns using tags by passing width values in percentages,
Share
define a proper doctype:
<!doctype html>This is very important for IE, because he uses another boxmodell if you don’t!be aware, that the current w3c-boxmodell only takes the content-width into account. This means, if you have margin, border and/or padding declared, this messes up your width.
If you define 80%/20% columns, but they have
border:1px ...this will mess up your design because effectively this means 80+20 = 100% + 4px for the border -> your page will break.You can switch boxmodell in newer browsers ( called box-sizing: from IE8 on) to use a “better” boxmodell, which accounts padding and/or border into your width declarations.
edit:
MDN-Link regarding box-sizing