文本属性

209 阅读1分钟
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .text{
            /* 颜色属性 */
            color:#123abc;
            /* 字号大小 */
            font-size: 30px;
            /* 字体 */
            /* 中文字体用引号括上 */
            font-family:"黑体" ;
            /* 字体加粗 */
            font-weight: bold;
            /* 字体倾斜 */
            font-style: italic;
            /* 文本修饰 */
            text-decoration: none;
                /* 下划线:underline */
                /* 上划线:overline */
                /* 删除线:line-through */
                /* 取消装饰线:none */
            /* 文本水平对齐 */
            text-align: left;
                /* 水平居中:center */
                /* 水平居左:left */
                /* 水平居右:right */
                /* 两端对齐:justify */
            /* 首行缩进 */
            text-indent: 10px;
            /* 字母之间间距 */
            letter-spacing: 5px;
            /* 单词之间的间距 */
            word-spacing: 5px;
            /* 文字阴影 */
            text-shadow: 5px 5px 5px yellow;
                /* 第一个值是水平偏移量 */
                /* 第二个值是垂直偏移量,正值向右,负值向左 */
                /* 第三个值是阴影模糊度,值越大模糊度越高 */
                /* 第四个值是颜色 */
        }
        span{
            color:red;
        }
    </style>
</head>
<body>
    <p class="text">hello world <span>hello</span>world</p>
    <!-- 如果p标签中有文字和整体不一致,放在span标签中进行设置 -->
</body>
</html>