Reputation: 1411
Currently I saw you can do something like:
body{
font-weight:bold;
font-style:italic;
}
Is there a way to do...
body{
font: bold italic???
}
Upvotes: 0
Views: 2198
Reputation: 114148
Yes, it is, just like you said, using font
:
p { font: bold italic large Palatino, serif }
From the docs:
The
font
property is, except as described below, a shorthand property for settingfont-style
,font-variant
,font-weight
,font-size
,line-height
andfont-family
at the same place in the style sheet.
Upvotes: 0
Reputation: 207891
Yes, via the CSS shorthand font rule.
Formal syntax: [ [ <‘font-style’> || || <‘font-weight’> || <‘font-stretch’> ]? <‘font-size’> [ / <‘line-height’> ]? <‘font-family’> ] | caption | icon | menu | message-box | small-caption | status-bar
See also: http://www.w3.org/TR/CSS2/fonts.html#font-shorthand
Some examples:
p { font: 12px/14px 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 }
Upvotes: 5