1、文本装饰:代表文字的样式,例如:下划线、删除线等等。

text-decoration: underline代表下划线;

text-decoration: line-through代表删除线;

text-decoration: overline代表上划线;

text-decoration: none代表默认格式,无格式。主要用于删除超链接的下划线。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>标题</title>
    <style type="text/css">
        p{
            text-decoration: underline;
        }
        a{
            text-decoration: none;
        }
    </style>
</head>
<body>
<p>这是一组测试数据。</p>
<a href="#">超链接</a>
</body>
</html>

 

2、文本对齐:代表文字对齐的方式,左对齐、右对齐、居中。

text-align:left代表左对齐

text-align:right代表右对齐

text-align:center代表居中

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>标题</title>
    <style type="text/css">
        h1 {
            text-align: left;
        }

        h2 {
            text-align: right;
        }

        h3 {
            text-align: center;
        }
    </style>
</head>
<body>
<h1>标题1</h1>
<h2>标题1</h2>
<h3>标题1</h3>
</body>
</html>

文本属性 

3、文字缩进:指段落首行缩进。

text-indent: 2em指缩进2字符 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>标题</title>
    <style type="text/css">
        p {
            text-indent: 2em;
        }
    </style>
</head>
<body>
<p>这是段落内容。这是段落内容。这是段落内容。。。。。。这是段落内容。。。。。。这是段落内容。。。。。。这是段落内容。这是段落内容。。。。。。这是段落内容。。这是段落内容。。。。。。这是段落内容。。。。。。</p>
</body>
</html>

文本属性 

 

相关文章: