为什么 Gmail 按钮是“div”标签而不是“按钮”标签?
为什么gmail按钮是“div”标签而不是“button”标签?
来自 chrome firebug 的 gmail 按钮代码:
<div id=":or" class="T-I J-J5-Ji ar7 T-I-ax7 L3 T-I-JO" role="button" tabindex="0" aria-expanded="false" style="-webkit-user-select: none; " aria-haspopup="true">
<span class="Ykrj7b">More</span>
<div class="G-asx T-I-J3 J-J5-Ji"></div>
</div>
提前致谢, 尤瑟夫
Why gmail buttons is "div" tag and not "button" tag?
The gmail button code from chrome firebug:
<div id=":or" class="T-I J-J5-Ji ar7 T-I-ax7 L3 T-I-JO" role="button" tabindex="0" aria-expanded="false" style="-webkit-user-select: none; " aria-haspopup="true">
<span class="Ykrj7b">More</span>
<div class="G-asx T-I-J3 J-J5-Ji"></div>
</div>
Thanks in advance,
Yosef
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最有可能是为了兼容性。
Internet Explorer 6 和 7 似乎添加了自己的 按钮元素的填充。此外,应用时这些浏览器中的按钮元素似乎存在宽度问题给他们设置样式。
Most likely for compatibility.
Internet Explorer 6 and 7 seem to be adding their own padding to button elements. Also, there seem to be width issues with button elements in those browsers when applying styles to them.
我认为 Google 会在性能方面达到疯狂的程度,因为在幕后
button
元素是 WebKit 堆栈中最长的旅程之一。如 Alex Russell 的视频所示。
I would assume its Google going to insane depths over performance, as behind the scenes the
button
element has one of the longer trips through the WebKit stack.As shown in this video by Alex Russell.
谷歌因此而闻名。他们在很多布局中也使用了表格。
他们如何做真的很重要吗? Gmail 似乎相当成功,尽管这并不是 W3C 所说的应该做的事情。
Google is famous for this. They use tables in a lot of their layouts too.
Does it really matter how they do it? Gmail seems to be pretty successful despite the fact that this is not the way the W3C says it should be done.