CKTIS / HTML
span — a neutral text container
The `span` element groups a text fragment without giving it meaning of its own. It supports global attributes, such as `class` or `lang`.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
<span class="name">text</span>span is a neutral container for phrasing content: text and elements used within paragraphs. It supplies no meaning of its own; use it when no more specific semantic element fits.
It is allowed where phrasing content is expected and may contain only phrasing content. HTML requires both its opening and closing tags. It supports global attributes, such as class, id, and lang.
In the example, class="product-code" allows styling AB-12 without changing the surrounding text. The class name does not give the element built-in meaning.
Examples
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Span example</title>
<style>
.product-code { color: #006400; }
</style>
</head>
<body>
<p>Product: <span class="product-code">AB-12</span>.</p>
</body>
</html>Result
Product: AB-12.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.