[Integrated pasting] The meaning of CSS "point" and the difference between ID class.

Source: Internet
Author: User

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 ;}
# Corresponding ID. corresponding class without corresponding HTML Tag 1. Difference between class and ID
A class is used to define one or more elements according to user-defined standards. For example, a script: A class can define the story line of each character in the script. You can use this class through CSS and JavaScript. Therefore, you can use class = "Frodo", class = "gandalf", class = "Aragorn" on a page to differentiate different story lines. Another important thing is that you can use any number of classes in a document. ID is usually used to define a tag that appears only once on the page. In structured layout of page layout (for example, a page is usually composed of a header, a header, a content area, and a footer), the ID is generally ideal, because an ID can only be used once in a document. These elements are rarely larger than once on the same page. 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. 2. the difference between margin and padding is to replace the most important function of a table-> A good way to split blocks, the difference is that margin is the distance between different tags, while padding is used for separation of different content in the same element, which is the most clear in the table. Especially when the background style is loaded for a region, the background color of the content under the padding changes, while the margin does not.

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.