Html5 css selector well number, difference between periods, html5 Selector

Source: Internet
Author: User

Html5 css selector well number, difference between periods, html5 Selector

I. Understand the style composition of CSS
Style sheets in CSS are composed of rules. Each rule consists of three parts:
1. selector (for example, "body" in the following example) to tell the browser which part of the document is affected by the rule;
2. attributes (such as font-family and color in the instance) specify what aspects of the layout are set;
3. The value (for example, Arial, sans-serif, #333333, etc. in the instance) gives the value of the style attribute.

Ii. Differences between different symbols in CSS styles

# Is the ID selector. Is the class selector * is the wildcard number
For example, * {margin: 0; padding: 0; all elements will follow this attribute style} (another case is IE hack. B {margin: 0; * margin: 10px;} Here, IE sees margin: 10px. other browsers will see the previous margin: 0;

Let's take a look at the code ~

body{font-family: Arial,sans-serif;color: #333333;line-height: 1.166; margin: 0px; padding: 0px;}#masthead{margin: 0;padding: 10px 0px;border-bottom: 1px solid #cccccc;width: 100%;}.feature img{float: left;padding: 0px 10px 0px 0px; margin: 0 5px 5px 0;}

# Id
Point number corresponds to class
Without adding html tags
In one sentence, the Class can be used repeatedly, and the ID can only be used once on a page. It is possible that the same ID will not be used repeatedly in many browsers, but it is definitely incorrect in terms of standards, and it may lead to practical problems in some browsers.
In practical application, the Class may be useful for text layout, and the ID is useful for macro layout and design of various elements.


Academic or football analysis and exchange: chinamaths (in discussion group)
Don't hesitate to comment or add a like-Yours Bill
Bill's technical blog Football analysis blog Full Color data video
Bill geek log_blog Bill football data _ Netease blog Football TV _ Youku
Bill geek log_csdn Bill football data _ Sina Blog Football TV _ Sohu video
Bill geek log_51cto Bill football data _ Sina Weibo Football TV _ Himalayan
Bill geek log_open source China Bill football data _ official URL Full Color TV _56 video
Bill geek log_github Bill football data _ toutiao.com No.: zucai99

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.