是否正确添加< span>在< a>内部标记标签? [英] Is it right to add <span> tag inside <a> tag?

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

问题描述

I was wondering if we could add a span tag inside a tag....

< a href =mydomain.com>< span style =font-weight:bold;>狗礼服< / span>< / a>< br> ;< / H2>

<h2 style="text-align: left;"><a href="mydomain.com"><span style="font-weight: bold;">Dog dresses</span></a><br></h2>

上述方法正确吗?是否可以安全地使用...?

我知道我们可以在这里定义一些类,让它进入像这样的其他元素。 / p>

I know that We can define some class here and let it go inside other elements like this.

<h2><a href="mydomain" class="bold">Dog dresses</a></h2>

.bold {font-weight: bold; }

OR

<h2 class="bold"><a href="mydomain">Dog dresses</a></h2>

h2.bold a { font-weight: bold; }

请分享您的观点..

推荐答案

是的,没关系。 < span> 是一个内联元素。除非您添加css display:block; ,否则它可以放在< a> 中。

Yes, it's fine. <span> is an inline element. Unless you add the css display: block; to it, it can go in the <a>.

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

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