【问题标题】:a href tag is not working in internet explorerhref 标签在 Internet Explorer 中不起作用
【发布时间】:2015-07-24 16:52:31
【问题描述】:

我正在我的页面中使用 href 标记创建一个按钮,该按钮在 chrome 中运行良好。但它在 Internet Explorer 中根本不起作用,按钮的代码是

 <td class='swMntTopMenu' style="text-align:right">
  <button style="background-color:rgb(255,213,32)">
     <a href ='list.php' style="text-decoration:none !important;">
       <div class="link"> Back  </div> 
     </a>
 </td>

并且使用的样式的代码是

.swMntTopMenu
            {
                background-color: #E2E4E5;
                /* float: center;*/
                width: 5%;
                margin-top: 2px;
                padding-bottom: 6px;
                border-bottom: solid 1px #d0ccc9;
            }

.link
            {
                color: #0E0202;
                text-decoration: none;
                background-color: none;
            }

谁能帮我解决这个问题?

【问题讨论】:

  • 哪个版本的IE?
  • 不工作是什么意思?
  • @DeepKakkar 我正在使用 IE 11
  • 您没有关闭您的button 元素。此外,button 中不能有 a
  • @Vucko 所以我可以用什么来重定向到另一个页面而不是锚点

标签: html css cross-browser href internet-explorer-11


【解决方案1】:

希望这会有所帮助

<a href ='list.php' style="text-decoration:none !important;"><button style="background-color:rgb(255,213,32)">  <div class="link"> Back </div> </button></a>

【讨论】:

    【解决方案2】:

    请尝试使用这种方式

    <form action="list.php">
        <input type="submit" value="Back">
    </form>
    

    【讨论】:

      【解决方案3】:

      正如我在评论中所说,您没有关闭您的 button 元素。另外,a 不能包含在 button 元素中。

      a 设置为看起来像一个按钮 - 这是一个不错的CSS button generator

      或者将button 放在一个表单中 - How to create an HTML button that acts like a link?

      【讨论】:

        【解决方案4】:

        在旧版 IE 中,当您将 div 放入其中时,应该有助于将 A 声明为块。

        a {display: block}
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-03-23
          • 2015-12-07
          • 1970-01-01
          • 2020-01-06
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多