嵌套<a>里面<按钮>在 Firefox 中不起作用 [英] Nesting <a> inside <button> doesn't work in Firefox
本文介绍了嵌套<a>里面<按钮>在 Firefox 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 里面有一个超链接标签,看起来像这样:
I have a <button>
with a hyperlink tag inside, looks like this:
<button class="btn"><a href="#"></a></button>
这在 Chrome 和 Safari 中运行良好,但在 Firefox 中不起作用(已测试 20 版).
This works well in Chrome and Safari, BUT doesn't work in Firefox (ver 20 tested).
怎么了?
推荐答案
要使其在所有浏览器中都能正常工作,Firefox 也必须将其更改为
To make it work in all browser, Firefox too you have to change it to
<a href="#"><button class="btn"></button></a>
或者按照 Billy Moat 的建议,在引导的情况下不需要 <button>
你可以做
or as suggested by Billy Moat in case of bootstrap there was no need of <button>
you could just do
<a href="#" class="btn">GO</a>
这篇关于嵌套<a>里面<按钮>在 Firefox 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文