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

Source: Internet
Author: User
Class and ID difference margin and padding difference CSS Learning notes _ Experience Exchange

Since now 99.99% of the CMS are using P+CSS to build Web templates, was forced helpless, a lot of age also to learn CSS, to tell the truth did not feel to use p to layout than table good where! But by the force of the trend, the first bite to see, can learn how much.
Based on the principle of separation of data and structure, CSS is best to be independent of the Web file, with

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

Statement to the CSS file into the Web page file, it is not recommended to write CSS code directly in the Web file. The advantage of doing so is to modify the convenience, the second is the search engine friendly, those search engine crawler crawling up also carefree.


margin and Padding properties
The margin and padding properties can be simply understood as the margin and padding of the element:

Margin-top, Margin-right, Margin-bottom, Margin-left, Padding-top, Padding-right, Padding-bottom and Padding-left

class and ID differences
In short, an ID name can appear only once in a page and the class can appear multiple times, of course, if an ID name appears in a page two times, the appearance of the opposite page does not have any impact, but does 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 reusable element, and a class definition.

Above is the class and ID difference margin and padding difference CSS Learning notes _ Experience Exchange content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • 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.