CSS font property | font weight w3c
ExampleSetsomefontpropertieswiththeshorthanddeclaration:p.a{ font:15pxArial,sans-serif;}p.b{ font:italicsmall-capsbold12px/30pxGeorgia,serif;}TryitYourself»[1]More"TryitYourself"examplesbelow.DefinitionandUsageThefontpropertyisashorthandpropertyfor:Thefont-sizeandfont-familyvaluesarerequired.Ifoneoftheothervaluesismissing,theirdefaultvalueareused.Note:Theline-heightpropertysetsthespacebetweenlines.Showdemo❯[2]Defaultvalue:ThedefaultvalueofthefontpropertiesInherited:yesAnimatable:yes,seeindiv...
ExampleSet some font properties with the shorthand declaration:
p.a { font: 15px Arial, sans-serif; }p.b { font: italic small-caps bold 12px/30px Georgia, serif;}
Try it Yourself »[1]More "Try it Yourself" examples below.
Definition and UsageThe font property is a shorthand property for:
The font-size and font-family values are required. If one of the other values is missing, their default value are used.
Note: The line-height property sets the space between lines.
Show demo ❯[2]
Default value: The default value of the font properties Inherited: yes Animatable: yes, see individual properties. Read about animatable[3] Try it[4] Version: CSS1 JavaScript syntax: object.style.font="italic small-caps bold 12px arial,sans-serif" Try it[5] Browser SupportThe numbers in the table specify the first browser version that fully supports the property.
Property ...