<span>


HTML <span> Tag

Instance

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
</head>
<body>

<p>我的母亲有 <span style="color:blue;font-weight:bold">蓝色</span> 的眼睛,我得父亲有 <span style="color:darkolivegreen;font-weight:bold">碧绿色</span> 的眼睛。</p>

</body>
</html>

Run Example»

Click the "Run Instance" button to view the online instance


Browser support

1000.png

All major browsers support< span> tag.


Tag definition and usage instructions

<span> is used to combine inline elements in the document.

<span> Tags have no fixed format. It only changes visually when you apply a style to it. If you don't apply styles to <span>, the text in the <span> element will not be visually different from other text.

<span> Tags provide a way to isolate a portion of text or a portion of a document.


Tips and Notes

Tips: The text contained by the <span> element, you can use CSS to define styles, or use JavaScript to style it Perform operations.


Differences between HTML 4.01 and HTML5

NONE.


Global attributes

<span> tag supports HTML Global properties.


Event attributes

<span> tag supports HTML event attributes.