Difference between class and ID: difference between margin and padding CSS learning notes

Source: Internet
Author: User

Currently, 99.99% of CMS uses Div + CSS to construct webpage templates, which is helpless. When the hacker is older, he still needs to learn CSS. To be honest, he does not think that DIV is better than table layout! However, as a result of this trend, let's start by looking at what we can learn.
Based on the principle of data and structure separation, CSS should preferably be independent of web files CopyCodeThe Code is as follows: <LINK rel = "stylesheet" type = "text/CSS" href = "../XXX/web.css"/>

You are not recommended to directly write CSS code in a webpage file. One advantage of this is convenient modification, and the other is that it is friendly to search engines, and those search engine crawlers can climb up smoothly.
Margin and padding attributes
The attributes of margin and padding can be simply understood as the margin and padding of elements: margin-top, margin-right, margin-bottom, margin-left, padding-top, padding-right, padding-bottom and padding-left
Difference between class and ID
Simply put, an ID name can only appear once on a page, while a class can appear multiple times. Of course, if an ID name appears twice on a page, the appearance of the opposite page does not affect anything, but does not comply with W3 specifications. Single element or needProgramAnd js-controlled things need to be defined by ID; reuse elements, defined by class.

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.