CSS Lint is harmful

Source: Internet
Author: User

CSS LINT, optimizing your CSS style sheet This article introduces some suggestions for using CSS in detail, so I recently started using brackets and installed Csslint extensions to check CSS styling problems, and found that my CSS had some error hints, Now looking back, in fact csslint some of the views are incorrect, even harmful. Here are some of these harmful places.

1. Do not use adjacent classes

For example, your CSS is. classone.classtwo{}

If you care about the performance of IE6, then this rule is good, otherwise it is nonsense, because other browsers can be processed.

Generally we write in this way is in code reuse, using this rule, can try to reduce the amount of CSS code, this is not the CSS we are pursuing the performance problem? If you really need IE6, you can use jquery code to fix

$ ("Classone.classtwo"). AddClass ("Ie6-classoneandtwo");

2. Do not use too many floats

Csslint Accounting calculates how many floats your page uses, ignoring it.

3. Do not use too many network fonts

Csslint It only calculates how many font styles you define in a style sheet, it doesn't involve how many fonts are used or how many fonts you load on a page, and of course loading more Web fonts slows down your loading speed.

4. Do not use too many font-size declarations

In fact, a page of the font design is mainly from the design diagram, we do not know how the designer will design this page, so please ignore this statement.

5. Do not use the ID on the selector

This rule comes from the author's understanding of Object-facing CSS. Object-oriented CSS, using the correct method is good. But it is absolutely nonsense to suggest that you do not use the ID. IDs are very useful, you should definitely use them, and they are the quickest way for a browser to select a given element. They are also anchor points in a page, and if they already exist, you can hook them up in style.

6. Unqualified Title 7. The elements of the title should maintain a consistent appearance 8. The style of the title should only be defined once

Finally: Performance is a browser hierarchy problem, it should not be html/css to fix or workaround, as long as we create effective and meaningful HTML and CSS, then we can not ignore those absurd rules. If you want to optimize your HTML and CSS, then you can combine your best practices, not by changing the performance.

Reference English: CSS Lint is harmful, not fully translated Chinese, personal understanding, strongly recommend that English students read the original text. Cai Bao All rights reserved, please do not reprint.

CSS Lint is harmful

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.