Cleverly use CSS Selector

Source: Internet
Author: User

Different rules can be used to define the link styles in different content blocks. Similar to this: # nav A: link or # Main A: link or # footer A: link. You can also define different styles for the same element in different content blocks. For example, use # Main P and # Sider P to define the # Main P and # Sider P styles respectively. In terms of structure, your page consists of pictures, links, lists, paragraphs, etc, these elements themselves do not affect the network devices (PDAs, mobile phones, or network TVs) displayed on which they can be defined as any representation.

A carefully structured HTML page is very simple, and every element is used for structural purposes. When you want to indent a paragraph, you do not need to use BLOCKQUOTE tags. You only need to use the P tag and add a CSS text-indent rule to P to indent the paragraph. P is a structured tag, text-indent is a manifestation attribute, the former belongs to HTML, and the latter belongs to CSS. (This is the separation of the legendary structure and manifestation)

The HTML page with a good structure has almost no labels showing attributes.CodeVery clean and concise. For example, the original code <Table width = "778" cellpadding = "3" border = "0" align = "center">, now, you can only write <Table id = "mrjin"> in HTML. All control items are written into CSS. In structured HTML, table is a table, rather than anything else (not to be used for layout and positioning ).

Of course, CSS selectors are not just that simple, except for IDS and classes, as well as descendant selectors and attribute selectors.

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.