<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#box{
width:300px;
height:100px;
background:pink;
line-height:normal;/*行高 默认值*/
line-height:20px;/*文本内容垂直对齐方式*/
font: italic bold 30px/100px "微软雅黑";
text-align:left;/*文本水平对齐方式*/
text-align:center;
text-align:right;
text-align:justify;/*两端对齐*/
}
#box1{
width:250px;
height:100px;
background:gold;
text-align:justify;
}
a{
text-decoration:none;/*文本修饰:取消;*/
}*/
.txt1{
text-decoration:underline;/*添加下划线*/
}
.txt2{
text-decoration:line-through;/*添加中划线*/
}
.txt3{
text-decoration:overline;
}
#box2,#box3{
width:400px;
background:pink;
font-size:30px;
}
#box2{
text-indent:2em;/*首行缩进 2*30*/
letter-spacing:0px;/*字符间距*/
}
#box3{
text-indent:60px;
word-spacing:0px;/*词间距*/
}
</style>
</head>
<body>
<!--
行高:
line-height:文本垂直对齐方式;
行高值 < 高度 值 偏上
行高值 = 高度 值 居中
行高值 > 高度值 偏下
综合写法
font:倾斜 加粗 文本大小/行高 字体类型;
注: 有顺序要求
文本水平对齐方式
text-align:;
left 左对齐
center 水平居中
right 右对齐
justify 两端对齐
文本修饰:
text-decoration:;
none 没有修饰
overline 上划线
line-through 中划线
undeline 下划线
首行缩进:
text-indent:;
px
em
字符间距:
letter-spacing:;
px
em
词间距
word-spacing:;
px
em
-->
<div id="box">文本内容!</div>
<div id="box1">哈哈哈哈哈哈哈哈哈哈哈哈hahahahha</div>
<a href="#">超链接自带下划线</a>
<p class="txt1">惊爆价</p>
<p class="txt2">原价</p>
<p class="txt3">不知道什么价不知道什么价</p>
</body>
CSS文本属性
最新推荐文章于 2024-10-09 20:00:56 发布