Is this valid? font: bold 10px/13px inherit;
According to my reading of the specs that should mean a font-weight of 'bold', a font-family of 'inherit', a font-size of '10px', and a line-height of '13px'.
It appears to work correctly in Internet Explorer 8 (8.0.6001.18702).
It works correctly in Safari 5.0.4 (7533.20.27) on Windows.
Opera 11.01 (build 1190) and Firefox 3.6.16 both log errors about it.
I haven't tried Chrome or Firefox 4 yet.
If this is indeed supposed to be valied is this parsing bug a known issue?
A couple extra points:
Update
As pointed out by Adam Wagner in his answer my attempted value is in fact not valid (despite what my naive reading of the spec suggested) due to § C.3.1 of the CSS2.1 spec.
5.5 CSS font shorthand The font property regroups (in this particular order): font-style. font-variant. font-weight.
The font CSS shorthand property sets all the different properties of an element's font. Alternatively, it sets an element's font to a system font.
The font property is used as shorthand for various font properties like font-size, font-style, font-family, font-weight and font-variant. Font properties: font-size: It specifies the size of the text. font-style: It specifies the style of text such as normal, italic, or oblique.
Approach: We will use the font property of CSS which is the shorthand property for all the font properties. This takes five values font-style, font-variant, font-weight, font-size and font-family. The font-size and font-family properties must be set for this property to work.
I think the issue is with the "inherit" addition to your value.
Per the specs:
[ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | inherit
I think the bold section I listed above is one option, and "caption", "icon", "menu", "message-box", and "inherit" are the remaining options.
In short, try: font: bold 10px/13px
Update:
It appears webkit has an outstanding bug report on this very problem. Not sure about firefox. (https://bugs.webkit.org/show_bug.cgi?id=20181)
Also, as someone in the ticket mentions, the 2.1 spec addresses this:
"Shorthand properties take a list of subproperty values or the value 'inherit'. One cannot mix 'inherit' with other subproperty values as it would not be possible to specify the subproperty to which 'inherit' applied. The definitions of a number of shorthand properties did not enforce this rule: 'border-top', 'border-right', 'border-bottom', 'border-left', 'border', 'background', 'font', 'list-style', 'cue', and 'outline'."
http://www.w3.org/TR/CSS21/changes.html#q142
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With