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中文网
Release: 2016-05-16 12:06:34
Original
1923 people have browsed it

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" />
Copy after login

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
Copy after login

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


Related labels:
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template