全局css , 样式设置, css 初始化. css ,style ,全局样式, 初始化样式

全局CSS设置总结

1、清除所有标记的内外边距

html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, fieldset, legend, img { margin:0; padding:0; }

2、全局文本大小、颜色设置

       body { color:#333; padding:5px 0; font:12px/20px "SimSun","宋体","Arial Narrow",HELVETICA; background:#fff; }

3、清除项目符号或编号前面的各种符号

ul, ol { list-style:none; }

4、全局链接效果

       a:link , a:visited{color:#444;text-decoration:none;}

       a:hover{color:#990000;text-decoration:underline;}

5、所有图片去边线

       img{border:0;}

6、合并表格的边线

       table{border-collapse:collapse;}

7、浮动和清除

       .float1{float:left;}

       .float2{float:right;}

       .clear{clear:both;}

8、常用颜色定义

       .blue{color:#0000ff;}

       .red{color:#ff0000;}

       ……

-----------------------------------------

1. 全局样式以及 辅助样式

-------------------

 1         /***1: 初始样式设置*******/
 2         html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, fieldset, legend, img, div,span, table,th,tr,td,button { margin:0; padding:0; }
 3 
 4 
 5         ul, ol {
 6             list-style: none;
 7         }
 8 
 9 
10         .hide {
11             display: none;
12         }
13 
14 
15 
16          /*******2: 清除浮动******/
17 
18         /*IE6, IE7 生效*/
19         .floatfix{
20             *zoom:1;
21         }
22 
23           /*其他浏览器*/
24           .floatfix:after{
25             content:"";
26             display:table;
27             clear:both;
28           }
29 
30           /***3: 超出长度显示省略号. 还需要设置width**/
31 
32           .ellipsis {
33               text-overflow: ellipsis;
34               overflow: hidden;
35               white-space: nowrap;
36           }
37 
38           /****4: 兼容的 不继承 的透明度*****/
39           .rgba {
40             background: rgb(0,0,0); /*The Fallback color,这里也可以使用一张图片来代替*/
41             background: rgba(0, 0, 0,0.5);
42             -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr=#80000000,endColorstr=#80000000)"; /*Filter for IE8 */
43             filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr=#80000000, endColorstr=#80000000); /*Filter for older IEs */
44            }

---------------------

.rgba 链接

原文地址:https://www.cnblogs.com/cbza/p/6929866.html