HTML如何使H1,H2等作为链接? [英] Html how to make H1, H2, etc as links?
本文介绍了HTML如何使H1,H2等作为链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将h1,h2等标题转换为链接以及标头和链接的search engines
索引文本的正确代码是什么?
What is the correct code for turning a h1, h2 etc heading into a link and search engines
index texts of header and link both?
是吗
<a href="#"><h1>heading</h1></a>
或
<h1><a href="#">heading</a></h1>
谁能解释为什么?
推荐答案
在此处: %flow
元素(在这种情况下为<h1>
)始终应包围%inline
元素(例如<a>
).
%flow
element which display as a block (in this case <h1>
) always should surround %inline
elements (such as <a>
).
另一个示例<div>
应该始终在<span>
之外.
Another example <div>
should always be outside <span>
.
也就是说:
<h1><a href="#">heading</a></h1>
是正确的.
一种更容易理解的方法是,以下几点很有意义:
An even easier way of under standing this is that the following makes sense:
<h1><a href="#1">my link</a> and <a href="#2">my other link</a></h1>
尝试在<a>
内使用多个<h1>
进行逆运算是非常不寻常的.
It would be highly unusual to try the inverse with multiple <h1>
s inside an <a>
.
这篇关于HTML如何使H1,H2等作为链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文