浅谈css样式(border、background、table)

border用法

border:边框。属性有:border-width,border-style,border-color。

1 <div id="d1">
2    高度200,宽带200,边框颜色为红色的边框。
3 </div>
1 #d1{
2  width:200px;
3  height:200px;
4  border:1px solid red;
5    }

 border-表示边框的粗细。border-style:边框样式。solid实线。dashed虚线。dotted:点线。border-color:边框颜色。

举例说明

1 #d1{
2  width:200px;
3  height:200px;
4  border:2px dashed red;
5    }

网页背景(background)

网页背景设置属性有:background-color:背景颜色。background-image:背景图片。background-position:背景图像的位置。background-attachment:fixed;规定背景图像是否固定或者随着页面的其余部分滚动。

举例说明:

1 <div id="d2">
2    背景小图标设置
3 </div>
1 #d2{
2 width:14px;
3 height:14px;
4 margin:0px;
5 padding:0px;
6 background-image:url(../image/iconNew.png);
7 background-position:left -50px;
8 background-attachment:fixed;
9 }

表格(table)

边框会合并为一个单一的边框。

1 table{
2 width:300px;
3 height:400px;
4 border:1px solid #ccc;
5 border-collapse: collapse;/*合并边框*/
6 }
原文地址:https://www.cnblogs.com/minguofeng/p/4827676.html