Tuesday, August 4, 2015

Internet Explorer and Initial Keyword CSS

I came across an issue with CSS and the initial keyword. In CSS initial is used to effectively inherit the properties from the parent. However this keyword is not supported in any versions of internet explorer which can lead to elements rendering incorrectly. The fix is to add the property inherit first, and then initial on the next line. This will allow the element to render correctly in IE and as normal in other browsers.
left: inherit !important; /* IE */
left: initial; /* Other Browsers*/

No comments:

Post a Comment