CSS Text

作者: roy_pub | 来源:发表于2018-11-26 21:46 被阅读11次
    color

    定义文本的颜色,取值有三种方式

    • 预定义颜色值,如 green, blue 等
    • 十六进制,如 #FFFFFF,#29DF74 等
    • RGB,如 rgb(222, 123, 45) 或 rgb(0%, 45%, 23%)
    line-height

    设置行高,单位一般用 px

    text-align

    设置文本内容的水平对齐

    • left 左对齐
    • right 右对齐
    • center 居中对齐
    text-indent

    设置文本首行缩进,建议使用 em 设置单位。1em 就是一个字的宽度,如果是汉字,1em 就是一个汉字的宽度。

    text-decoration

    常用于给链接修饰装饰效果

    • none 默认,定义标准的文本
    • underline 定义文本的下划线,下划线也是链接自带的
    • overline 定义文本的上划线
    • line-through 定义穿过文本的一条线
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <style type="text/css">
            .decNone {
                text-decoration: none;
            }
    
            .decUnderline {
                text-decoration: underline;
            }
    
            .decOverline {
                text-decoration: overline;
            }
    
            .decThrough {
                text-decoration: line-through;
            }
        </style>
    </head>
    <body>
        <p class="decNone">This is china</p>
        <p class="decUnderline">This is china</p>
        <p class="decOverline">This is china</p>
        <p class="decThrough">This is china</p>
    </body>
    </html>
    

    相关文章

      网友评论

        本文标题:CSS Text

        本文链接:https://www.haomeiwen.com/subject/pplpqqtx.html