English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Das HTML-<span>-Element ist ein allgemeiner Inline-Content-Container für Phraseninhalte und hat keine spezielle Semantik. Es kann verwendet werden, um Elemente zu gruppieren, um eine bestimmte Stylisierung zu erreichen (durch Verwendung von Class- oder Id-Attributen), oder diese Elemente haben gemeinsame Attribute, wie z.B. lang. Es sollte nur verwendet werden, wenn keine anderen angemessenen semantischen Elemente vorhanden sind. Das <span>-Element ist sehr ähnlich zum <div>-Element, aber das <div> ist ein Block-Element, während das <span> ein Inline-Element ist .
Verwenden Sie das <span>-Element, um einen Teil des Textes zu färben:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Grundlagen-Tutorial(oldtoolbag.com)</title> </head> <body> <p>Hier siehst du <span style="color:blue;font-weight:bold">blauen</span> der Himmel, noch <span style="color:green;font-weight:bold">green</span> of the grass.</p> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the <span> tag.
The <span> is used to combine inline elements within a document.
The <span> tag does not have a fixed format. It only produces visual changes when styles are applied to it. If no style is applied to the <span>, the text within the <span> element will not have any visual difference from other text.
The <span> tag provides a way to isolate a part of the text or a part of the document.
Tip:The text enclosed by the <span> element in HTML, you can define its style using CSS or manipulate it with JavaScript.
None.
<span> Tag supports Global Attributes of HTML.
<span> Tag supports HTML Event Attributes.