All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----org.w3c.css.properties.CssProperty
|
+----org.w3c.css.properties.CssFont
Value: [ <font-style> || <font-variant> ||
<font-weight> ]? <font-size> [ / <line-height> ]?
<font-family>
Initial: not defined for shorthand properties
Applies to: all elements
Inherited: yes
Percentage values: allowed on <font-size> and
<line-height>
The 'font' property is a shorthand property for setting 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height' and 'font-family' at the same place in the style sheet. The syntax of this property is based on a traditional typographical shorthand notation to set multiple properties related to fonts.
For a definition of allowed and initial values, see the previously defined properties. Properties for which no values are given are set to their initial value.
P { font: 12pt/14pt sans-serif }
P { font: 80% sans-serif }
P { font: x-large/110% "new century schoolbook", serif }
P { font: bold italic large Palatino, serif }
P { font: normal small-caps 120%/120% fantasy }
In the second rule, the font size percentage value ('80%') refers to the font size of the parent element. In the third rule, the line height percentage refers to the font size of the element itself.
In the first three rules above, the 'font-style', 'font-variant' and 'font-weight' are not explicitly mentioned, which means they are all three set to their initial value ('normal'). The fourth rule sets the 'font-weight' to 'bold', the 'font-style' to 'italic' and implicitly sets 'font-variant' to 'normal'.
The fifth rule sets the 'font-variant' ('small-caps'), the 'font-size' (120% of the parent's font), the 'line-height' (120% times the font size) and the 'font-family' ('fantasy'). It follows that the keyword 'normal' applies to the two remaining properties: 'font-style' and 'font-weight'.
public CssFont()
public CssFont(CssExpression expression) throws InvalidParamException
public Object get()
public String toString()
public void setImportant()
public boolean getImportant()
public void print(CssPrinterStyle printer)
public void addToStyle(CssStyle style)
public void setInfo(int line,
String source)
public boolean equals(CssProperty property)
public void setSelectors(CssSelectors selector)
public CssProperty getPropertyInStyle(CssStyle style,
boolean resolve)
public String getPropertyName()
All Packages Class Hierarchy This Package Previous Next Index