Shorthand Method for Text Formatting
2011-12-27 13:05
281 查看
CSS offers a shorthand property called font, which lets you combine the following properties into a single line: font-style ,font-variant ,font-weight , font-size , line-height , and font-family .
You don’t have to include every one of these properties, but you must include the font size and font family: font: 1.5em Georgia, Times, serif.
Use a single space between each property value.You use a comma only to separate fonts in a list like this: Arial, Helvetica, sans-serif.
When specifying the line height, add a slash after the font size followed by the line-height value, like this: 1.5em/150% or 24px/37px.
The last two properties must be font-size (or fontsize/line-height) followed by font-family, in that order. All the other properties may be written in any order. For example both font: italic bold small-caps
1.5em Arial; and font: bold small-caps italic 1.5em Arial; are the same.
Finally, omitting a value from the list is the same as setting that value to normal. Say you created a <p> tag style that formatted all paragraphs in bold, italics, and small caps with a line height of 2000 percent (not that you’d actually do that). If you then created a class style named, say, .special-Paragraph with the following font declaration font: 1.5em Arial; and applied it to one paragraph on the page, then that paragraph would not inherit the italics, bold, small caps, or line height. Omitting those four values in the .specialParagraph style is the same as writing this: font: normal normal normal 1.5em/normal Arial/;.
You don’t have to include every one of these properties, but you must include the font size and font family: font: 1.5em Georgia, Times, serif.
Use a single space between each property value.You use a comma only to separate fonts in a list like this: Arial, Helvetica, sans-serif.
When specifying the line height, add a slash after the font size followed by the line-height value, like this: 1.5em/150% or 24px/37px.
The last two properties must be font-size (or fontsize/line-height) followed by font-family, in that order. All the other properties may be written in any order. For example both font: italic bold small-caps
1.5em Arial; and font: bold small-caps italic 1.5em Arial; are the same.
Finally, omitting a value from the list is the same as setting that value to normal. Say you created a <p> tag style that formatted all paragraphs in bold, italics, and small caps with a line height of 2000 percent (not that you’d actually do that). If you then created a class style named, say, .special-Paragraph with the following font declaration font: 1.5em Arial; and applied it to one paragraph on the page, then that paragraph would not inherit the italics, bold, small caps, or line height. Omitting those four values in the .specialParagraph style is the same as writing this: font: normal normal normal 1.5em/normal Arial/;.
相关文章推荐
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Element
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Node 错误解决办法
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Node 的解决办法(eclipse)
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Node方法报错
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Element
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Node解决方法(eclipse)
- 项目报错:The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Node
- MATLAB读取写入文本数据最佳方法 | Best Method for Loading & Saving Text Data Using MATLAB
- The method getTextContent() is undefined for the type Node
- The method getTextContent() is undefined for the type Node
- Eclipse常见问题解决 - The method getTextContent() is undefined for the type Node.