---
title: "What is a span?"
term: "span"
description: "A 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."
url: "https://glossary.io/span/"
published: "2026-11-22T20:44:50.500Z"
updated: "2026-11-22T20:44:50.500Z"
topics:
  - "Web development"
wikidata: "https://www.wikidata.org/wiki/Q94092650"
---

# What is a span?

**Definition:** A 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](https://glossary.io/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](https://glossary.io/semantic-html/) first makes content more accessible and easier for search engines and [screen readers](https://glossary.io/screen-reader/) to interpret.

## Related terms

- [div](https://glossary.io/div/)
- [Screen reader](https://glossary.io/screen-reader/)
- [Semantic HTML](https://glossary.io/semantic-html/)

**Topic:** [Web development](https://glossary.io/topics/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/.

Published November 22, 2026.
