css中设置段落缩进的属性是什么


本文摘自PHP中文网,作者青灯夜游,侵删。

css中设置段落缩进的属性是“text-indent”,语法格式“text-indent:length|%;”;当值为“length”时可定义固定的缩进,当值为“%”类型时可定义基于父元素宽度的百分比的缩进。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

css中设置段落缩进的属性是“text-indent”。

示例:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

<!DOCTYPE html>

<html>

    <head>

        <meta charset="UTF-8">

        <title>首行缩进</title>

        <style>

            .demo{

                width: 500px;

                height: 200px;

                margin: 50px auto;

            }

            .p1{

                text-indent:36px;

            }

            .p2{

                text-indent:1em;

            }

            .p3{

                text-indent:10%;

            }

        </style>

    </head>

    <body>

        <div class="demo">

            <p class="p1">这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。<b>text-indent:36px;</b></p>

            <p class="p2">这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。<b>text-indent:1em;</b></p>

            <p class="p3">这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。这是一段测试代码,是关于css文本缩进的一段文字。<b>text-indent:10%;</b></p>

        </div>

    </body>

</html>

效果图:

1.png

【推荐教程:CSS视频教程】

说明:

text-indent 属性规定文本块中首行文本的缩进。

注意: 负值是允许的。如果值是负数,将第一行左缩进。

属性值:

描述
length定义固定的缩进。默认值:0。
%定义基于父元素宽度的百分比的缩进。

更多编程相关知识,请访问:编程视频!!

以上就是css中设置段落缩进的属性是什么的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

css属性前缀的作用是什么?

css punctuation-trim属性怎么用

css中box是什么文件

怎么用css设置记录用户密码

css中怎么设置虚线上边框

css怎么给图片添加两个边框

css如何修改字体大小

css伪元素是用来干嘛的

利用css实现鼠标悬停效果

css border-top-color属性怎么用

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...