【发布时间】:2016-08-03 03:47:03
【问题描述】:
我不知道为什么会这样。我有一个链接,它是一个按钮的子元素,它应该在它被激活时将您带到页面的不同部分。该链接在 Chrome 中有效,但是当我尝试在 Internet Explorer 上加载该页面时,链接不起作用。这是我的这部分网站的 HTML 和 CSS:
HTML:
<form method="get" action="http://www.google.com/search" target="_blank">
<div style="border:1px solid black;padding:4px;width:20em;float:right;display: inline-block;">
<table border="0" align="center" cellpadding="0">
<tr><td>
<input type="text" name="q" size="25"
maxlength="255" value=""/>
<input type="submit" value="Google Search" /></td></tr>
<tr><td align="center" style="font-size:75%">
</td></tr></table>
</div>
</form>
<div id="score_container">
<button id="cubs_score"><a href="#scoring_widget">How are the Cubs Doing?</a></button>
<button id="packers_score"><a href="#scoring_widget">How are the Packers Doing?</a></button>
</div>
CSS:
#cubs_score{
width: 300px;
height: 100px;
color: #CC3433 !important;
background-color: #0E3386;
font-size: 30px;
text-align: center;
font-variant: small-caps;
padding: 10px;
margin: auto;
z-index: 3;
position: relative;
text-decoration: none;
}
#packers_score{
width: 300px;
height: 100px;
color: #FFB612 !important;
background-color: #203731;
font-size: 30px;
text-align: center;
font-variant: small-caps;
padding: 10px;
margin: auto;
position: relative;
z-index: 3;
text-decoration: none;
}
#score_container{
width: 310px;
height: 200px;
padding: 20px;
background-color: grey;
z-index: 2;
color: inherit;
}
我签入的IE版本是10和11。
【问题讨论】:
-
作为按钮子级的链接是无效的 HTML
-
您可以为您的评分小部件发布 html 吗?您是使用任何 JS 进行跳转还是仅使用纯 HTML? CSS 很可能与此无关。
-
哦,我不知道。有什么方法可以让我使用 div 但让它具有与按钮相同的简洁视觉效果? @j08691
-
我不会让 div 具有视觉效果,但我认为链接会很棒。您可以在链接中添加悬停和单击 css,这样您就可以使它们具有各种视觉效果。
标签: javascript html css google-chrome internet-explorer