Class and ID difference margin and padding differences CSS Learning notes _ Experience Exchange

Source: Internet
Author: User
Tags class definition
Because now 99.99% of the CMS is to use DIV+CSS to build the Web page template, was forced helpless, a lot of age to learn CSS, to tell the truth did not feel the layout with div better than table where! But by force, first bite the bullet to see, can learn how much is how much.
According to the principle of separating the data from the structure, CSS is better to be independent of the Web page file,
Copy Code code as follows:

<link rel= "stylesheet" type= text/css "href=". /xxx/web.css "/>

Statement to transfer a CSS file into a Web page file, it is not recommended to write CSS code directly in the Web page file. The advantage of doing so is to modify the convenience, the second is to search engine friendly, those search engine crawler crawling up also carefree.
Margin and Padding properties
The margin and padding attributes can be easily 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
Class and ID Difference
To put it simply, an ID name can appear only once in a page and class may appear multiple times, of course, if an ID name appears in a page two times, the appearance of the opposite page but what effect, just do not conform to the W3 specification. A single element, or something that requires a program or JS control, needs to be defined with an ID, a reused element, and a class definition.
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.