What is a span?
DefinitionA span is a generic inline HTML element that wraps a piece of text or other inline content so it can be styled with CSS or targeted with JavaScript, without adding any meaning of its own.
Unlike a div, which is a block-level container, a span sits within a line of text and doesn't start a new line. Developers use spans to style part of a sentence, such as a highlighted word, to mark a phrase in another language with a lang attribute, or to give scripts a hook for updating content. Like a div, a span only gets meaning from the classes, IDs or attributes added to it.
Because a span tells browsers and assistive technologies nothing about its content, it shouldn't be used where a more specific element fits. Emphasis belongs in the em or strong elements, links in a, buttons in button, and code in code. Using semantic HTML first makes content more accessible and easier for search engines and screen readers to interpret.
Topic: Web development
Cite this definition
- APA
What is a span? (2026, November 22). Glossary. https://glossary.io/span/
- MLA
“What Is a span?” Glossary, Coywolf, 22 Nov. 2026, glossary.io/span/.
- Chicago
“What Is a span?” Glossary. Coywolf. November 22, 2026. https://glossary.io/span/.
- HTML link
<a href="https://glossary.io/span/">What is a span?</a>
Published