Home >Web Front-end >CSS Tutorial >The difference between Span and Div in web pages_Experience exchange

The difference between Span and Div in web pages_Experience exchange

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

They are used to combine a large piece of HTML code and assign certain information. Most of them are associated with elements using the class attribute and the identification attribute id. See the class and id selectors in the CSS Intermediate Guide.

The difference between span and p is that span is inline and used in a small piece of inline HTML, while p (think about what pision means) elements are block-level (simple In other words, it is equivalent to having line breaks before and after it) and is used to combine a large block of code.

 
 This is crazy



In practice, p and especially span should not be abused, despite other opinions to the contrary . For example, if you want to emphasize the word "crazy" and the bold "paper", you might use code like this:

 
 This is crazy



This is better than adding another span.

No clue about the class and identifier id? Don’t worry, you’ll get to them in the intermediate CSS guide. All you need to remember is that span and p are "meaningless" tags.

The above is the difference between Span and Div in web pages_the content of experience exchange. 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