所有css字体属性的一个css声明

时间:2010-11-18 19:08:24

标签: css

将所有css字体属性放入一个值的正确语法是什么。

body {font: 12px, arial, red}

类似的东西,但包含所有选择器和属性。

3 个答案:

答案 0 :(得分:41)

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

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

您不能将颜色包含在声明中。 15px / 20px = font-size / line-height alt text

很好的链接,maegar!

答案 1 :(得分:4)

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

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

答案 2 :(得分:1)

相关问题