content logo

Learn HTML:

Html span tag

The HTML <span> tag is a generic container for inline elements and content. This allows you to apply styles and other attributes to the content within the <span> element.

 The element itself doesn't represent anything other than its children. It is similar to the <div> tag, except that the <div> tag is used for block-level content (as opposed to inline content that the <span> element contains).

 The basic tag is written like this <span class=""></span> with the grouped content between the opening and closing tags. In this example we are using the class attribute, which can be used to apply styles to the contents of the <span> element. The value provided here would need to be the name of a CSS class. See below for more information about attributes that can be used with the <span> element.

Example

The following example shows the <span> element in action.

<blockquote>If you're white and you're wrong, then you're wrong; if you're black and you're wrong, you're wrong. <span style="font-size:larger;">People are people</span>. Black, <span style="color:blue">blue</span>, <span style="color:pink">pink</span>, <span style="color:green">green</span> - God make no rules about color; only society make rules...</blockquote>
<cite>Name Family</cite>

 

#

HTML Span Example

#

HTML Span Code

#

HTML Span Tutorial