Wednesday, 18 March 2009

CSS Differences in Internet Explorer and FireFox

1) parentElement

innerText VS elem.firstChild.nodeValue;
This uses W3C DOM compliant properties to retrieve the text value of the first TextNode of the cell. This makes it more likely to work across browsers.

2) Width in IE and Firefox

According to standard (that FireFox follows), content width is set excluding paddings and border(see figure there).
"The size of the box is the sum of the element width (i.e. formatted text or image) and the padding, the border and the margin areas".

But in IE the width of the box is the width of the content plus any border or padding.
In other words:
width(IE)="padding-left"+"border-left"+ width(FF) + "padding-right"+"border--right".

==============================================
DETAILS: http://geekswithblogs.net/mnf/archive/2008/02/13/differences-in-internet-explorer-and-firefox-css-and-javascript.aspx

More tips can be found in Adrian Anttila's post JavaScript differences in Firefox and Internet Explorer


No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter