[CSS] Concise tutorial The difference between span and Div

Source: Internet
Author: User
Tags contains
css| Tutorials | 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 does not have the meaning of the structure, is purely applied style, when the line 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, and Div is also used to create a logical part of the HTML file. But unlike span, which works at the level of text blocks, it introduces row dividers both 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.