CSS样式表——样式

样式:

1)大小

200px;       或100%;                           //样式中要加单位

height:100px;

2)背景

background-color:背景色;

background-image:背景图;

background-repeat:背景图是否拼图;

background-position:right 20px bottom 20px;              //距右边20像素,距底边20像素

background-attachment:fixed;                                      //背景图固定

background-attachment:scroll;                                      //背景图随页面滚动

background-size:200px 100px;                                      //背景图宽200像素,高100像素

3)字体

font-family:微软雅黑;                     //字体

font-size:10px;                             //字号,网页常用14px/16px,最小12px

font-style:italic;                              //倾斜

font-weight:bold;                         //加粗

text-decoration:underline;           //下划线

      overline / linethrough / none       上划线、字中间横线、没有线

color:字体颜色;

4)对齐方式

text-align:center;                    //水平对齐方式:居中

    left / right                      居左、居右

vertical-align:middle;                //垂直居中

      top / bottom             顶部、底部

line-height:200px;                     //行高,要想让文字垂直居中,需要将文字行高调整到和所在<div>一样高

text-indent:30px;                        //缩进30像素

原文地址:https://www.cnblogs.com/cmzhphp2017/p/7463683.html