Home  >  Article  >  Web Front-end  >  Tips on using CSS compiled by CSS novices

Tips on using CSS compiled by CSS novices

巴扎黑
巴扎黑Original
2017-03-18 14:05:411115browse

[Introduction] 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

1. Do not use too small pictures 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 above and below 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 text should be 1.6 times the text size and the title should be 1.3 times.

14. Use full-width for Chinese punctuation. English mixed with Chinese, left and right spaces, half-width.

15. It is better to keep away from bold and italic Chinese fonts, which is beneficial to the people and oneself.

The above is the detailed content of Tips on using CSS compiled by CSS novices. For more information, please follow other related articles on the PHP Chinese website!

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
Previous article:css relative positioningNext article:css relative positioning