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

来源:互联网 发布:魔蝎数据是什么样的 编辑:程序博客网 时间:2024/05/16 23:36

一,文本属性

这里写图片描述

<!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>
0 0