What everyone needs to know is the difference between SPAN and DIV in HTML_Experience exchange

WBOY
Release: 2016-05-16 12:07:32
Original
1718 people have browsed it

The difference between SPAN and DIV is that DIV (division) is a block-level element that can contain paragraphs, titles, tables, and even chapters, abstracts, notes, etc. SPAN is an inline element. There will be no line breaks before and after SPAN. It has no structural meaning and is purely for applying styles. When other inline elements are not suitable, SPAN can be used.

The following uses an example to illustrate the difference between these two properties.

Code:

The SPAN tag has an important and useful feature, that is, it does nothing. Its only purpose is to surround other elements in your HTML code. , so you can style them. In this example, the identifier allows you to divide a paragraph into different parts.

There is another identifier with a similar function,

DIV is also used to create logical sections in HTML files. But unlike
SPAN,
works at the text block level, and it introduces line separation before and after the HTML elements it contains.

Effect:

The SPAN tag has an important and practical feature, that is, it does nothing. Its only purpose is to surround other elements in your HTML code, so that you You can then assign styles to them. In this example, identifiers allow you to break a paragraph into different parts.

There is another identifier with a similar function,
DIV is also used to create logical sections in HTML files. But unlike
SPAN,
works at the text block level and introduces line separation both before and after the HTML elements it contains.

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!