HTML <span> tag

Updated: 10/11/2017 by Computer Hope

HTML span tagWhen writing in HTML, the <span> tag is used as an inline container for grouping or phrasing content. It is useful when you want to change the language of a section of text, or its styling, via the use of CSS or the <style> tag. The following sections contain information about this tag, including an example of it in use, as well as related attributes and browser compatibility.

Example code

<p>I drive an <span style="color:orange">orange</span> car.</p>

Example result

I drive an orange car.

Attributes

Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair. While the <span> tag does not have any unique attributes, it does utilize all of the standard attributes.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
All versions All versions All versions All versions All versions

Browser, Compatibility, CSS, HTML div tag, Web design terms