Review the document structure of CSS and css documents

Source: Internet
Author: User

Review the document structure of CSS and css documents

Source: http://limits.cnblogs.com

Let's take a look at several basic HTML pages.

1 <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 

Shown as follows:

The document structure is as follows:

Special features:

Specify the weights of different rules. When multiple rules can be used for the same element, the style with higher weights will be preferentially used.

 

H1 {color: red;}/* Special = 1 */p em {color: blue;}/* Special = 2 */. divclass {color: yellow;}/* Special = 10 */p. note em. dark {color: gray;}/* Special = 22 */# id {color: black;}/* Special = 100 */

Use! Important to identify important rules, such as: p {color: red! Important;}. At this time, color: red will have the highest weight, because the declared rules will be higher than the definition of the visitor's local style (that is, the definition in the P label), so! Use important with caution.

Element category:

  1. Block-level element (display: block): Each block-level element starts from a new line, in addition, the subsequent elements also need to start with a new line of titles, paragraphs, tables, layers, and bodies, which are block-level elements;
  2. Inline element (display: inline): inline elements do not need to be displayed on a new line, nor are they forced to wrap the subsequent elements, such as a, em, span and so on, inline elements can be child elements of any other element;
  3. List item (display: list-item): Only the li element is of the default type, and the expression of this element is the same as that of the list;
  4. Hidden element (display: none): When an element is set to display: none, the browser will completely ignore this element and this element will not be displayed or occupied.

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.