Everyone needs to master the difference between HTML under span and div _ Experience Exchange

Source: Internet
Author: User
The difference between SPAN and Div is that Div (division) is a block-level element that can contain paragraphs, headings, tables, and even chapters, summaries, and notes. span is an inline element, the span is not wrapped around, it has no structural meaning, is purely applied style, when other inline elements are not appropriate, you can use span.

Here is an example to illustrate the difference between the two properties.

Code:

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

There is also an identifier that has similar functionality, and the
Div is also used to create a logical part in an HTML file. However, unlike
span,
works at the level of text blocks, and it introduces row dividers both before and after the HTML elements it contains.

Effect:

The span tag has an important and practical feature that it does nothing, and its sole purpose is to surround the other elements in your HTML code so that you can specify a style for them. In this case, the identifier allows you to divide a paragraph into different parts.

There is also an identifier that has a similar function,
Div is also used to create logical portions in HTML files. But with
span is different,
Work at the level of a block of text, which introduces row dividers both before and after the HTML elements it contains.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.