Consider a scenario in which the CSS attribute is missing a unit (px, em, pt,%):
<body> <div style= "width:170; border:1 dotted PaleGreen; background-color:MistyRose"> The quick brown </div> </body>
Questions:
- Why would he drop the px? Is a pixel always preferred? Is there any rule defined in the W3C working draft or recommendations?
- Is there a rule that makes reservation of a preferred unit mandatory for UA?
- Given the above example, the following behavior follows from the following:
- Internet Explorer: in Quirks mode (IE6,5,4 ..), the width and width of the border are used to return to px. Starting with IE7 (until now, IE10RP), it ignores the entire rule if the unit is missing. Therefore, both rules were ignored.
- Firefox 13: In the above example, the width drops to px, but the border-width is ignored.
- Chrome 19, Opera 12, Safari 5.1.2: Returns the width and width of borders to px.
Note. At Microsoft Connect, they said:
The problem you are reporting is by design. IE10 in standard mode ignores width or height without a unit according to CSS standards. The device is optional.
html css cross-browser w3c
vulcan raven
source share