You need to master the difference between the HTML span and the 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. While span is an inline element, span is not wrapped, it has no structural meaning, it is purely applied, and spans can be used when other inline elements are not appropriate.

The difference between these two properties is illustrated in an example below.

Code:

The span tag has an important and useful feature, which is that it doesn't do anything, its sole purpose is to surround other elements in your HTML code so that you can assign styles to them. In this example, the identifier allows you to divide a paragraph into different parts.

Another identifier has a similar function, and the
Div is also used to create a logical part of the HTML file. However, unlike
span,
works at the block level of text, which introduces line separation before and after the HTML elements it contains.

Effect:

The span tag has an important and useful feature, that is, it doesn't do anything, its sole purpose is to surround other elements in your HTML code so that you can assign styles to them. In this example, 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 of HTML files. But with
span is different,
Works at the block level of text, which introduces line separation before and after the HTML elements it contains.
  • Related Article

    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.