HTML <span> tag

Updated: 04/02/2019 by Computer Hope
HTML span tag

When 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 of <span> code

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

Example result

I drive an orange car.


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 the standard attributes.


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

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