HTML语义:将链接(锚元素)放在标题中是个好主意吗? [英] HTML semantics: Is it a good idea to put links (anchor elements) in headings?

查看:47
本文介绍了HTML语义:将链接(锚元素)放在标题中是个好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以这种方式建立新闻列表是错误的:

Is that wrong to build news list this way:

   <h1><a href="article-1.html">That happened!</a></h1>
   <div class="short">Just like planned</div>

我要这个吗?

   <h1>That happened!</h1>
   <div class="short">Just like planned</div>
   <div><a href="article-1.html">Read it now</a></div>

还是删除标题元素?

   <div class="news-header"><a href="article-1.html">That happened!</a></div>
   <div class="short">Just like planned</div>

推荐答案

将锚点放在标题内在语法上是有效的.

It is syntactically valid to put anchors inside headings.

您的第一个示例: H1 应包含页面标题,例如新闻".新闻项目的列表"应使用子标题( H2 ).在详细信息"页面上,您可以将新闻标题放在 H1 中.

Your first example: H1 should contain the page heading such as "News". The "list" of news items you should use a sub-heading (H2). On the "details" page you can put the news title in H1.

您的第二个示例:就SEO而言,它是有效的,但效果不佳.包含诸如更多",单击此处"之类的文本的链接不会告诉搜索引擎该链接的含义.

Your second example: it is valid but not good as far as SEO is concerned. Links that contain text such as "read more", "click here" etc do not tell the search engine what the link is about.

您的第三个示例:它对于SEO是有效且合理的.但是请注意,搜索引擎认为标题和粗体标签内使用的单词的权重更高.

Your third example: it is valid and reasonably good for SEO. But note that the weight of the words used inside heading and bold tags is considered higher by search engines.

这篇关于HTML语义:将链接(锚元素)放在标题中是个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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