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)!