我们可以添加< span>在H1标签内? [英] Can we add a <span> inside H1 tag?

查看:139
本文介绍了我们可以添加< span>在H1标签内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在H1标签内使用span标签是否正确?

 <h1>
    <span class="boardit">Portfolio</span>
</h1> 

我知道我们可以用这种方式编写它……并且还在我自己的网站中遵循以下语法.

 <h1 class="boardit">
  <span>Portfolio</span>
</h1> 

但是,我只是想知道html的简洁形式.

解决方案

是的.

HTML4可以这样说:

<!ENTITY % heading "H1|H2|H3|H4|H5|H6">
<!--
  There are six levels of headings from H1 (the most important)
  to H6 (the least important).
-->

<!ELEMENT (%heading;)  - - (%inline;)* -- heading -->

%inline; 是:

<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">

%special; 包括<span>. /p>

当前 HTML这么说:

内容内容
短语内容

定语内容 包括<span>.

Is it a proper method to use span tag inside H1 tag?

<h1>
    <span class="boardit">Portfolio</span>
</h1>

I know we can write it in this way...and am also following the below syntax in my own website..

<h1 class="boardit">
  <span>Portfolio</span>
</h1>

However, I Just wanted to know the cleaner form of html..

解决方案

Yes you can.

HTML4 has this to say:

<!ENTITY % heading "H1|H2|H3|H4|H5|H6">
<!--
  There are six levels of headings from H1 (the most important)
  to H6 (the least important).
-->

<!ELEMENT (%heading;)  - - (%inline;)* -- heading -->

And %inline; is:

<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">

And %special; includes <span>.

The current HTML has this to say:

Content contents
Phrasing content

And Phrasing content includes <span>.

这篇关于我们可以添加&lt; span&gt;在H1标签内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆