每天一个css text-align
2015-09-22 20:14
671 查看
Value: | left | right | center | justify | inherit |
初始值: | 如果direction的值为ltr,则text-align的初始值为left,如果direction的值为rtl,则text-align的初始值为right |
应用范围: | 块级容器,如div等 |
是否继承: | 是 |
Percentages: | N/A |
Media: | visual |
计算值 | 初始值或者特别指定的值 |
参考网址:http://www.w3.org/TR/CSS21/text.html#propdef-text-aligndirection
Value: | ltr | rtl | inherit |
Initial: | ltr |
Applies to: | all elements, but see prose |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | as specified |
Value: | left | right | center | justify | inherit |
Initial: | a nameless value that acts as 'left' if 'direction' is 'ltr', 'right' if 'direction' is 'rtl' |
Applies to: | block containers |
Inherited: | yes |
Percentages: | N/A |
Media: | visual |
Computed value: | the initial value or as specified |
left, right, center, justifyLeft, right, center, and justify text, respectively, as described in the section on inline formatting.
A block of text is a stack of line boxes. In the case of 'left', 'right' and 'center', this property specifies how the inline-level boxes within each line box align with respect to the line box's left and right sides; alignment is not with respect to the viewport. In the case of 'justify', this property specifies that the inline-level boxes are to be made flush with both sides of the line box if possible, by expanding or contracting the contents of inline boxes, else aligned as for the initial value. (See also 'letter-spacing' and 'word-spacing'.)
If an element has a computed value for 'white-space' of 'pre' or 'pre-wrap', then neither the glyphs of that element's text content nor its white space may be altered for the purpose of justification.
Note: CSS may add a way to justify text with 'white-space: pre-wrap' in the future.
In this example, note that since 'text-align' is inherited, all block-level elements inside DIV elements with a class name of 'important' will have their inline content centered.
div.important { text-align: center }
Note. The actual justification algorithm used depends on the user-agent and the language/script of the text.
Conforming user agents may interpret the value 'justify' as 'left' or 'right', depending on whether the element's default writing direction is left-to-right or right-to-left, respectively.
相关文章推荐
- css中的优先级
- CSS之Sass Compass
- 个人的浏览器重置样式表(总结)
- [看书][CSS精粹(第2版)]第三章 CSS和图像 & HTML网页布局
- css设置div等标签背景半透明
- 你所不了解的css选择器补充
- css中div层置顶解决办法
- CSS3绘制环形进度条
- css中使用rgba和opacity设置透明度的区别
- CSS布局 ——从display,position, float属性谈起
- 你所不了解的css选择器
- css禁止html标签被选中和复制
- 修改FileUpload样式
- wpf动态设置控件样式
- 纯CSS实现的3D倒计时效果
- 四个好看的CSS样式表格
- CSS渐变
- css使用li索引或偶数行
- JS+CSS实现带小三角指引的滑动门效果
- 2015年9月21号css第一次课