Home  >  Article  >  Web Front-end  >  DIV CSS 15 CSS common sense tips that even experts must read_html/css_WEB-ITnose

DIV CSS 15 CSS common sense tips that even experts must read_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:29:091021browse

1. Do not use images that are too small for background tiles. This is why a lot of people don't use 1px, just know it. Tiling an image with a width and height of 1px to an area of ​​200px requires 200*200=40,000 times and takes up resources.
2. No borders. The recommended writing method is border:none;, haha, I use this all the time. border:0; only defines the border width as zero, but the border style and color will still be parsed by the browser and occupy resources.
3. Use the * wildcard with caution. The so-called wildcard is to initialize all tags in CSS, regardless of whether they are used or not, outdated or advanced, and treated equally. This consumes a lot of resources. There should be optional initialization tags.
4. CSS hexadecimal color code abbreviation. I got used to abbreviations and lowercase letters, and then I realized that it was not the recommended way of writing, in order to reduce the resources occupied by analysis. But it will also increase the file size. Which one is better or worse needs to be carefully verified.
5. Put the style on the head and the script on the foot. Not embedded, only external links.
6. Never use CSS expressions.
7. Use to reference the style sheet instead of importing it through @import.
8. Generally speaking, PNG is smaller than GIF, much smaller. Then again, how much color is wasted in GIFs is well worth optimizing.
9. Never scale images in HTML. One does not look good, and the other takes up resources.
10. It is best to use even numbers for text fonts, 12px, 14px, 16px, the effect is very good. Special case, 15px.
11. Leave at least one line spacing at the top and bottom of block, ul, ol, etc., at least twice the line spacing on the left side, and optionally on the right side.
12. There must be at least double line spacing between paragraphs.
13. Forcibly specify the line-height of certain elements. The main text should be 1.6 times the text size and the title should be 1.3 times.
14. Use full-width Chinese punctuation. English mixed with Chinese, left and right spaces, half-width.
15. It is better to stay away from bold and italic Chinese fonts, as it benefits the people and oneself.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn