Difference between Class and ID: difference between margin and padding CSS learning notes _ experience exchange

Source: Internet
Author: User
Difference between Class and ID: difference between margin and padding CSS learning notes Difference between Class and ID: difference between margin and padding CSS learning notes _ experience exchange

Because 99.99% of CMS uses p + css to construct webpage templates, it is forced to be helpless. The hacker needs to learn CSS when he is older. To be honest, he does not think that p 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

 

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 margin and padding attributes can be simply understood as the outer and inner margins 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. A single element, or something that requires program and JS control, needs to be defined by id; elements that are reused are defined by class.

The above is the difference between Class and ID. The difference between margin and padding is the difference between CSS learning notes _ experience exchange content. For more information, please follow the PHP Chinese Network (www.php1.cn )!

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.