css| Code | Web page
1. Select the correct character set for CSS.
This problem may not arouse the attention of many people, but in the process of website development, I found it is very important to select the correct character set for CSS, if your Web page is using GB2312, then add a @charset "gb2312" to the top of the CSS file. This can ensure that the CSS and Web pages to maintain the same character set, if the page is using Utf-8, then the top of the CSS file plus @charset "Utf-8";
2. Correctly plan CSS
Typically, I'll define some common styles in the beginning of the CSS file, as in the following example:
Body {font:12px Arial, Helvetica, Sans-serif;color: #000; background: #fff;p adding:0px;margin:0px;text-align:center;}
div,form,img,ul,ol,li,dl,dt,dd,p {margin:0;padding:0;border:0;}
Ul{float:left;}
Li{list-style:none;}
a{Text-decoration:none;}
This has become a habit of me, the Web page commonly used elements of the basic style definition, encountered a special situation and redefined, which can greatly reduce the size of the CSS file, but also more conducive to the maintenance of CSS.
3. Learn to use CSS abbreviation syntax
I suggest you take a look at this article common CSS abbreviation syntax summary