Home  >  Article  >  Web Front-end  >  Explanation of the difference between div and span in HTML

Explanation of the difference between div and span in HTML

高洛峰
高洛峰Original
2017-03-09 16:04:452581browse

Friends who make web pages must not know the difference between div and span in HTML. Here is a detailed introduction to the common points and differences between the two

Common points:

DIV Tags and SPAN tags treat some content as a whole, for example, hiding it as a whole and moving it as a whole. Something like a box. This can streamline the code and improve efficiency.

Differences:

1. div puts the content into a rectangular block, and moving it at will will affect the layout. Span only defines the content as a whole and operates it without affecting the layout and display.

2. div is generally used for typesetting, while span is generally used for local text styling.


The above is the detailed content of Explanation of the difference between div and span in HTML. For more information, please follow other related articles on the PHP Chinese website!

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