Difference between SPAN and DIV in CSS style sheets

Source: Internet
Author: User
The difference between SPAN and DIV is that division is a block-level element that can contain paragraphs, titles, tables, and even chapters, summaries, and remarks. While SPAN is an element in the row, it does not wrap the line before and after the SPAN. It has no structural meaning and is purely an application style. When other elements in the row are not appropriate, you can use SPAN.
The following example shows the difference between the two attributes.
Code:
<Span> a span tag has an important and practical feature, that is, it does nothing. Its only purpose is to focus on other elements in your HTML code, in this way, you can specify styles for them. In this example, the <span> identifier allows you to divide a paragraph into different parts.
An identifier has similar functions. <div> DIV is also used to create a logical part in an HTML file. Unlike <div> SPAN, <div> is used at the text block level. It separates rows 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 focus on other elements in your HTML code, in this way, you can specify styles for them. In this example, the identifier allows you to divide a paragraph into different parts.
There is also an identifier with similar functions, and DIV is also used to create a logical part in an HTML file. But unlike SPAN, it works at the text block level. It 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.