文本颜色:color 文本的对齐方式:text-align 文本修饰: text-decoration:none 取消下划线 text-decoration:overline 添加上划线 text-decoration:line-through 添加中划线 text-decoration:underline 添加下划线 文本转换: /*小写转大写*/ text-transform:uppercase /*大写转小写*/ text-transform:lowercase /*单词首字母大写*/ text-transform:capitalize 文本缩进: text-indent:50px; 所有属性: 属性 描述 letter-spacing 设置字符间距 line-height 设置行高 direction 设置文本方向 text-shadow 设置文本阴影 text-transform 控制元素中的字母 unicode-bidi 设置或返回文本是否被重写 vertical-align 设置元素的垂直对齐 white-space 设置元素中空白的处理方式 word-spacing 设置字间距
文本格式
文本格式
This text is styled with some of the text formatting properties.
The heading uses the text-align, text-transform, and color properties.
The paragraph is indented, aligned, and the space between characters is specified.
The underline is removed from the "尝试一下" link.
CSS text-align 实例
2015 年 3 月 14 号
“当我年轻的时候,我梦想改变这个世界;当我成熟以后,我发现我不能够改变这个世界,我将目光缩短了些,决定只改变我的国家;当我进入暮年以后,我发现我不能够改变我们的国家,我的最后愿望仅仅是改变一下我的家庭,但是,这也不可能。当我现在躺在床上,行将就木时,我突然意识到:如果一开始我仅仅去改变我自己,然后,我可能改变我的家庭;在家人的帮助和鼓励下,我可能为国家做一些事情;然后,谁知道呢?我甚至可能改变这个世界。”
注意: 重置浏览器窗口大小查看 "justify" 是如何工作的。
文本修饰
百度一下
李白
杜甫
孟浩然
文本转换
This is some text.
This is some text.
This is some text.
/*h1 {*/
/*color: #FFA500;*/
/*!*文本的对齐方式*!*/
/*text-align: center;*/
/*}*/
/*h2 {*/
/*color: rgb(255, 0, 0);*/
/*}*/
p.date {
/*文本的对齐方式*/
text-align: right;
}
p.main {
/*文本的对齐方式*/
text-align: justify;
}
a {
text-decoration: none; /*取消下划线*/
}
/*添加上划线*/
h1 {
text-decoration: overline;
}
/*添加中划线*/
h2 {
text-decoration: line-through;
}
/*添加下划线*/
h3 {
text-decoration: underline;
}
/*小写转大写*/
p.uppercase {
text-transform: uppercase;
}
/*大写转小写*/
p.lowercase {
text-transform: lowercase;
}
/*单词首字母大写*/
p.capitalize {
text-transform: capitalize;
}
/*文本缩进*/
p {
text-indent: 50px;
}