css基础学习之文本和颜色属性

本文介绍了CSS中用于设置文本外观的重要属性,包括文本装饰、水平对齐、缩进及颜色属性。通过这些属性可以有效地调整网页中文本的显示效果。
一,文本属性

这里写图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>06-css文本数属性.html</title>

    <!--
        1,文本装饰属性
        格式:text-decoration: underline;
        取值:
        overline:上划线
        underline:下划线
        line-through:中划线
        none:什么都没有,一般用在去掉超链接的下划线

        2,文本水平对齐属性
        格式:text-align: center;

        3,文本缩进属性
        格式:text-indent: 2em;
        取值:2em,em是单位,1个em是一个文字
    -->

    <style>
        p{
            text-decoration: underline;
            /*text-decoration: line-through;*/
            /*text-decoration: none;*/
            /*text-decoration: overline;*/
            text-align: left;
            text-indent: 2em;
        }
        a{
            text-decoration: none;
        }
    </style>
</head>
<body>

<p>我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本我是文本</p>
<a href="#">我是超链接</a>
</body>
</html>
二,颜色属性
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>07-css颜色属性.html</title>

    <!--
        在css中怎么通过color属性来修改文字的颜色
        格式:color:值;
        取值:
        (1),英文单词
        常见的颜色都有英文单词表达
        (2),rgb
        特点值越大就会越亮
        红色:rgb(255,0,0)
        (3),rgba
        (4),16进制缩写
    -->
    <style>
        p{
            /*color: red;*/
            /*color: rgb(150,150,150);*/
            color: #ff0000;
        }
    </style>
</head>
<body>

<p>我是文本</p>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值