14

What is the proper syntax for putting all css font properties into one value.

body {font: 12px, arial, red}

Something like that but with all the selectors and properties.

thenengah
  • 42,557
  • 33
  • 113
  • 157

3 Answers3

44
body{
    font: bold italic 15px/20px arial,sans-serif;
    color: red;
}

http://www.w3schools.com/css/tryit.asp?filename=trycss_font

you can't include the color as part of the declaration. 15px/20px = font-size/line-height alt text

nice link, maegar!

5
font: [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit

Source: http://www.w3.org/TR/CSS2/fonts.html#font-shorthand

Harmen
  • 22,092
  • 4
  • 54
  • 76
  • Thanks for this answer. I was specifically looking for where the line-height attribute fitted and your answer helped me find it quickly. Very useful. – Peter David Carter Jun 10 '16 at 11:01
1

http://www.w3.org/TR/CSS2/fonts.html

For a tutorial:

http://www.w3schools.com/css/pr_font_font.asp

wajiw
  • 12,239
  • 17
  • 54
  • 73