css - 使用字体速记属性设置其他字体属性时,保持多个标题的浏览器默认字体大小

标签 css fonts shorthand

是否可以使用字体速记属性而不更改字体来调整h1h6的默认浏览器字体属性-size,像这样:

h1, h2, h3, h4, h5, h6 { font:400 normal/1.2 rockwell,sans-serif; }

我想替代方案是不使用速记(如下所示),但如果可能的话,我会很高兴知道。

h1, h2, h3, h4, h5, h6 {
   font-weight:400;
   line-height:1.2;
   font-family:rockwell,sans-serif;
}

最佳答案

不,根据这个 (http://www.w3schools.com/cssref/pr_font_font.asp):

The font shorthand property sets all the font properties in one declaration.

The properties that can be set, are (in order): "font-style font-variant font-weight font-size/line-height font-family"

The font-size and font-family values are required. If one of the other values are missing, the default values will be inserted, if any.

关于css - 使用字体速记属性设置其他字体属性时,保持多个标题的浏览器默认字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7950211/

相关文章:

用于检查对象数组内特定键值的 JavaScript 快捷方式

jquery ui 图标未以跨度为中心

jquery - 使用 jQuery 根据字体系列更改正文字体大小

php - 基于 PHP 中另一个变量的存在来定义一个变量的简写条件

css - 漏洞?与 chrome 中的自定义字体对齐

java - UTF-8 字符显示不正确

javascript - 创建多个具有相同值的索引 - 简写

javascript - 如何在悬停时更改图像

html - 设置 <table> 大小的最佳做法是什么?

html - last-of-type 选择器没有按预期工作