我目前正在使用HTML5开展大学项目。 我一直在使用按钮标签编写所有代码。 我一直在使用chrome测试网站,但是,刚刚注意到虽然按钮出现在IE和Firefox中,但它们不起作用。
有没有办法解决这个问题?或者按钮标签在这些浏览器中不起作用?
这是在Chrome中完美运行的代码,但不适用于其他浏览器。
<div class="option" id="question1" style="display:none">
<p> Which way do you think the criminals have fled?</p>
<p>Up the Stairs <button class="arrow" id="stairs"><a href="upstairs.html"><img src="images/arrow.png" width="15" height="15"/></a></button></p>
<p>Down the Alley <button class="arrow" id="alley"><a href="alley.html"><img src="images/arrow.png" width="15" height="15"/></a></button></p>
</div>
答案 0 :(得分:2)
button
元素不能包含交互式后代。因此,您不能将a
标记作为button
元素的子标记。只需从a
中删除button
标记,然后根据需要更改代码。
有关详细信息,请阅读button
Element in the HTML Specification。
<div class="option" id="question1" style="display:none;">
<p>Which way do you think the criminals have fled?</p>
<p>Up the Stairs <button class="arrow" id="stairs"><img src="images/arrow.png" width="15" height="15"></button></p>
<p>Down the Alley <button class="arrow" id="alley"><img src="images/arrow.png" width="15" height="15"></button></p>
</div>