HTML basic tutorial <span> tag

This section explains the <span> tag. Let’s summarize the three tags <em>, <strong>, <span>:

  • < The ;em> and <strong> tags are used to emphasize keywords in a paragraph, and their semantics are emphasis.

  • The <span> tag has no semantics. Its function is to set a separate style.

If now we want to set the dynasty and author in the previous poem to red (red red), but note that it is not to emphasize this, but just to set it differently from other words. style (you don't want screen readers to read out dynasties and accents), so in this case the <span> tag can be used.

As the following example:

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
<style>
span{
 color:red;   
}
</style>
    <body>
       <h1>水调歌头·丙辰中秋</h1>
<pre>
<span>朝代:宋代
作者:苏轼</span>
<strong>丙辰中秋,欢饮达旦,大醉,作此篇,兼怀子由。</strong>

明月几时有,把酒问青天。不知天上宫阙,今夕是何年。我欲乘风归去,又恐琼楼玉宇,高处不胜寒。起舞弄清影,何似在人间?
<em>转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,此事古难全。但愿人长久,千里共婵娟。</em>
<pre>
    </body>
</html>

Note: This section uses the knowledge of CSS, please understand it first. After we learn CSS, we will understand it

Continuing Learning
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <style> span{ color:red; } </style> <body> <h1>水调歌头·丙辰中秋</h1> <pre> <span>朝代:宋代 作者:苏轼</span> <strong>丙辰中秋,欢饮达旦,大醉,作此篇,兼怀子由。</strong> 明月几时有,把酒问青天。不知天上宫阙,今夕是何年。我欲乘风归去,又恐琼楼玉宇,高处不胜寒。起舞弄清影,何似在人间? <em>转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,此事古难全。但愿人长久,千里共婵娟。</em> <pre> </body> </html>
submitReset Code