概述
CSS line-height
Run
Stack editor
Unstack editor
Examplep {
font-size: 5vw;
padding: 0 5vw;
line-height: 1.8em;
}
CSS line-height is similar to leading in desktop publishing - it determines the "line height" (suprised?). This gives the impression of lines of text being closer together or further apart. Changing the line height in conjunction with using the letter-spacing, word-spacing, float properties can produce some nice looking layouts.
The CSS line-height property is similar to leading in desktop publishing — it determines the "line height". This results in lines of text appearing closer together or further apart.
On a block container element whose content is composed of inline-level elements, line-height specifies the minimal height of line boxes within the element.
On a non-replaced inline element, line-height specifies the height that is used in the calculation of the line box height.
Also see the letter-spacing and word-spacing properties.
Syntax
line-height: normal | | | | inherit
Possible Values
The line-height property accepts the following values.
normal
Specifies that the user agent should use a "reasonable" value based on the font of the element. This is typically between 1.0 and 1.2.
Specifies the line height using a length value (for example 1.3em). The specified length is used in the calculation of the line box height. Negative values are illegal.
Specifies the line height using a number value (for example 1.3). The used value of the property is this number multiplied by the element's font size. Negative values are illegal.
Specifies the line height using a percentage value (for example 130%). The computed value of the property is this percentage multiplied by the element's computed font size. Negative values are illegal.
In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:
initial
Represents the value specified as the property's initial value.
inherit
Represents the computed value of the property on the element's parent.
unset
This value acts as either inherit or initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.
General Information
Initial Value
normal
Applies To
All elements
Inherited?
Yes
Media
Visual
Animatable
Example Code
p {
line-height: 1.6em;
}
Official Specifications
CSS Transitions (W3C Working Draft — specifies the property as animatable)
CSS Level 2.1 (W3C Recommendation 07 June 2011)
CSS Level 1 (W3C Recommendation 17 Dec 1996)
最后
以上就是激情万宝路为你收集整理的css3 lineheight,CSS line-height的全部内容,希望文章能够帮你解决css3 lineheight,CSS line-height所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复