背景、文本格式、

一、

    1.背景颜色由background-color属性定义,页面的背景颜色在body选择器中使用,颜色可以是十六进制,RGB,颜色名称(英文)。

      【示例:body {background-color:#b0c4de;}】

    2.背景图像由background-image属性描述,背景图像默认平铺重复(水平或垂直平铺)显示,覆盖整个元素实体。

      【示例:body {background-image:url('paper.gif');}】

    3.background-repeat属性设置使图像不平铺(目的是让背景图像不影响文本的排版)。

      【示例:

                    body
                    {
                    background-image:url('img_tree.png');
                    background-repeat:no-repeat;
                    }

         】

         甚至是改变图像位置!

       【示例:

                    body
                    {
                    background-image:url('img_tree.png');
                    background-repeat:no-repeat;
                    background-position:right top;
                    }

         】

    4.背景的简写属性为background,属性值的顺序为:background-color,background-image,background-repeat,background-attachment,background-attachment,background-position(以上属性不需要全部使用)。

二、

    1.文本颜色的设置与背景颜色设置一样方法,但需在style中设置。

      【示例:<style>
                    body {color:red;}
                    h1 {color:#00ff00;}
                    p.ex {color:rgb(0,0,255);}
                    </style>】

     2.text-align属性设置文本对齐方式。

      【示例:h1 {text-align:center;} p.date {text-align:right;} p.main {text-align:justify;}

     3.text-decoration属性设置或删除文本修饰。

      【示例:h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;}

     4.text-transform属性设置文本转换,指定文本中的大写和小写字母。

      【示例:p.uppercase {text-transform:uppercase;} p.lowercase {text-transform:lowercase;} p.capitalize {text-transform:capitalize;}

     5.text-indent属性设置文本缩进。

      【示例:p {text-indent:50px;}

原文地址:https://www.cnblogs.com/masker99/p/10810092.html