为什么按钮不鼓励导航? [英] Why are button's discouraged from navigation?

查看:117
本文介绍了为什么按钮不鼓励导航?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个有争议的问题,但我正在环顾网络,似乎网络开发人员喜欢将< a> 标签看起来像按钮,比使用特定的< button> 标记。我在看导航时已经注意到了这一点。

This may be an opinionated question, but I was looking around the web and it seems like web developers like to style <a> tags to look like buttons, rather than use a specific <button> tag. I've noticeably seen this when looking at navigations

经过一番研究,我发现:

After a bit of research, I found this:



  • 按钮不是搜索友好的,因为搜索引擎中的文本是不可见的。

  • 按钮比链接更难更新,


  • 按钮的加载速度较慢,因此对移动访问者来说尤其糟糕。

  • 即使您想要使用非标准字体,由于类似于TypeKit的工具,按钮也是不必要的。
    〜引用自这里

  • Buttons are not search friendly, since the text within is invisible to search engines.
  • Buttons are harder to update than links, requiring Photoshop and a new image for every update.
  • Buttons load more slowly that links, making them especially bad for mobile visitors.
  • Buttons are less accessible to the visually impaired.
  • Buttons are unnecessary, even if you want to use non-standard fonts, thanks to tools like TypeKit. ~ quoted from here

但是,大多数这些原因似乎很脆弱,像'你需要photoshop'似的答案...好...无效?

However, most of these 'reasons' seems quite flimsy and answers like 'you need photoshop' seem... well... invalid?

所以我想知道:

在创建导航菜单时不使用< button> c>标签,而是将< a> 标签的样式看起来像按钮? strong>
为什么不是按钮的规范?这不是他们做的吗?

Is there an actual reason why the <button> tags aren't used when creating navigation menus, and instead style <a> tags to look like buttons? Why aren't buttons the norm? Is this not what they're made for?

*我不想在这里听到你的意见,也不希望看。

* I do not wish for your opinion here, nor viewpoint. Only factual information as to why this is the case

推荐答案

在阅读评论中张贴的多个文档后,

After reading up on multiple documents posted in the comments, it seems that there is actually a clear factual reason buttons are not used in navigation bars.

当有网页重定向或将用户带到网站的其他地方时,会使用这些

These are used when there is a page redirect or taking a user elsewhere on the website.



  • 如果导航,它是一个链接。使用具有有效超文本引用的链接标记

链接不是按钮



按钮元素



当您想要 doSomething() / strong>重定向用户。也就是说提交表单等。

Button elements

These are used when you want to doSomething() that is not redirecting the user. I.e. submitting a form / etc.

你需要问自己的问题是:

The question you need to ask yourself is:

此控件是否可用于立即执行操作 是否导航到其他网页?

Will this control be used to initiate an immediate action or Is the action to navigate to another page?

如果你的问题的答案是第一部分,你应该使用一个按钮元素。如果是您希望执行的后者,则使用元素

if the answer to your question is the first part, than you should be using a button element. Whereas if it is the latter that you are wishing to do, then you should be using an a element.

进一步阅读:

链接不是按钮。也不是DIV和SPAN

何时使用按钮元素

这篇关于为什么按钮不鼓励导航?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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