CSS Super Tips (1)

Source: Internet
Author: User
Tags define
css| tips one. Using CSS abbreviations

Using abbreviations can help reduce the size of your CSS files and make it easier to read. The main rules for CSS abbreviations refer to the common CSS abbreviation syntax summary, which does not expand the description.

Two. Define units clearly, unless the value is 0

Forgetting to define the size of the unit is a common error for CSS Novice. In HTML you can write only width=100, but in CSS you have to give an exact unit, such as: width:100px width:100em. Only two exceptions can be defined without a unit: row height and 0 value. In addition, values must be closely followed by the unit, note, do not add spaces between values and units.

Three. Case sensitive

The element names defined in CSS,CSS are case-sensitive when used in XHTML. To avoid this error, I recommend that all defined names be lowercase.

The values of class and ID are case-sensitive in HTML and XHTML, and if you have to mix the case, carefully verify that your definition of CSS is consistent with the tags in XHTML.

Four. To cancel the element qualification before class and ID

When you write an element to define class or ID, you can omit the previous element qualification because the ID is unique on a page, and 鴆 Las S can be used more than once in the page. You define an element without meaning. For example:

div#content {/* declarations */}
Fieldset.details {/* declarations */}

can be written

#content {/* declarations */}
. details {/* declarations */}

This can save some bytes.



Related Article

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.