What is the specific use of HTML span in CSS styles? Example

Source: Internet
Author: User
This article focuses on the properties of span tags and the role of span tags and the difference between span and Div.

Let's give you a simple example of using HTML span code:

<! DOCTYPE html>

Effects such as:

Everyone should know that most HTML elements are defined as block-level elements or inline elements.

Here the <div> element is a block-level element that defines a partition or section in a document that is used with CSS to set style properties on large chunks of content.

The <span> element is an inline element that is used to combine inline elements in a document. A container that can be used as text. When used with CSS, it can also be used to set style properties for some text. such as the red text in the above.

In fact, if you do not apply styles to spans, the text in the span element does not have any visual differences from other text. However, the span element in the previous example still adds additional structure to the P element.

The difference between a span and a div is that the div is a block-level element that wraps around the elements, and <span> is just an inline element that does not wrap before or after it. and <span> tags can be included in the <div>, as a child of the <div>, but the reverse is not true.

So the above on the "what is the meaning of the span tag" related to the specific introduction, I hope to have the necessary friends to help.

"Recommended for the relevant content"

HTML tag Classification

HTML tags

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.