Home >Web Front-end >CSS Tutorial >The difference between Class and ID, the difference between margin and padding CSS study notes_Experience exchange

The difference between Class and ID, the difference between margin and padding CSS study notes_Experience exchange

PHP中文网
PHP中文网Original
2016-05-16 12:06:341903browse

the difference between class and id, the difference between margin and padding, css study notes_experience exchange

since 99.99% of cms now use p css to build web page templates , i was forced to have no choice but to learn css at an advanced age. to be honest, i don’t think using p for layout is any better than table! but due to the current situation, let’s just bite the bullet and see how much we can learn.
according to the principle of separation of data and structure, it is best for css to be independent of web page files. use the

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

statement to transfer css files into web page files. it is not recommended to write css code directly in web page files. the advantages of this are that it is easy to modify, and it is friendly to search engines, so those search engine crawlers can crawl easily.


margin and padding attributes
the margin and padding attributes can be simply understood as the outer margin and inner margin of the element:

margin-top, 
margin-right, 
margin-bottom, 
margin-left, 
padding-top, 
padding-right, 
padding-bottom and padding-left

the difference between class and id
to put it simply, an id name can only appear once in a page and class can appear multiple times. of course, if an id name appears twice in a page , it has no impact on the appearance of the opposite page, except that it does not comply with w3 specifications. single elements, or things that require program or js control, need to be defined with id; reused elements are defined with class.

the above is the difference between class and id, the difference between margin and padding, css study notes_experience exchange content, for more related content, please pay attention to the php chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn