Get the difference between CSS SPAN and DIV_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:29:25
Original
1341 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 is an example to illustrate the difference between these two attributes.

Code:

An important and useful feature of the SPAN tag is that 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 that has a similar function,

DIV is also used to create logical parts in HTML files. But unlike
SPAN,
works at the text block level, introducing line separation both before and after the HTML element 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 that has a similar function,

DIV is also used to create logical parts 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.

Related labels:
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