网页CSS1

样式的属性

1,背景与前景

 1 background-color:        //背景的颜色
 2 
 3 background-image:url        //背景图片
 4 
 5 background-attachment:fixed;     //背景固定不随字体滚动,scroll 背景随着字体滚动
 6 
 7 background-repert:no-repeat;   //图片不平铺, repeat平铺 repeat-x横向平铺  repeat-y纵向平铺
 8 
 9 background-position:center;     //背景居中  ,repeat必须为no-repeat
10 
11 background-position:right top;     //背景图放在右上角
12 
13 background-position:left 100px top 200px;        //离左边100像素,离上边200像素, 也可设置负值。

2,字体

font-family:                //字体

font-size:                    // 字体的大小 常用12px 14px

font-weight:                 //bold 加粗 normal正常

font-style:                 // italic倾斜 normal正常

color:                          //颜色

text-decoration:           //underline下划线 overline上划线 line-through删除线 none去掉下划线

text-align:                //center 居中对齐 left 左对齐 right 右对齐

vertical-align:            // middle 居中对齐 top 顶部对齐 bottom底部对齐 一般设置了行高在使用。

text-indent:20px;          //首行缩进量

line-height:20px;             //行高

3,边界边框

border 边框
border:  5px solid  blue;             //四边框 5像素 实线  蓝色

border-5px ;                       //  分别设置
border-style:solid;
border-color:blue;  

border-top: 5px solid blue              // 顶边框单独设置其他边框一个道理 bottom下  left左   right右


表外间距
margin:10px;           //四边外边框的宽度 auto表示居中

margin-top: 10px;       //上边外边框的宽度10px

margin: 20px  0px 20px 0px;    //按照上右下左 设置的


内容和边框的间距
padding跟margin    一样。
原文地址:https://www.cnblogs.com/999c/p/4291857.html