Css 为什么ie7缺少文本装饰:鼠标上方加下划线?
为什么ie7不在鼠标上方应用Css 为什么ie7缺少文本装饰:鼠标上方加下划线?,css,internet-explorer,Css,Internet Explorer,为什么ie7不在鼠标上方应用文本装饰:下划线 <style type="text/css"> <!-- .main{ padding: 0 10px; height:45px; float:left; color:#191919; text-align:center; overflow:hidden; list-style: none; text-decoration: none; } .mai
文本装饰:下划线
<style type="text/css">
<!--
.main{
padding: 0 10px;
height:45px;
float:left;
color:#191919;
text-align:center;
overflow:hidden;
list-style: none;
text-decoration: none;
}
.main:hover{
padding: 0 10px;
height:45px;
float:left;
color:#191919;
text-align:center;
overflow:hidden;
list-style: none;
text-decoration: underline;
}
-->
</style>
<li class="main" style=" float: right; ">
<p style=" color: #555; cursor: pointer;">
<a style=" color: #555; text-decoration: none;" href="test.php">TEST</a>
</p>
</li>
尝试将溢出更改为可见,看看它是否显示在ie7中。而且还要加上!重要的
此外,悬停中还有很多多余的行,它们与.main中的相同,因此不需要。因此,如果您愿意,可以通过删除这些行来清理这些内容
.main:hover{
padding: 0 10px; //you don't need this line
height:45px; // nor this one
float:left; // nor this one
color:#191919; //nor this one
text-align:center; // nor this one
overflow: visible;
list-style: none; // nor this one
text-decoration: underline !important;
}
您是否尝试在实际锚定标记上应用样式
a:hover{
padding: 0 10px;
height:45px;
float:left;
color:#191919;
text-align:center;
overflow:hidden;
list-style: none;
text-decoration: underline;
}
我相信随着CSS的更新版本,文本装饰的价值已经从只有一个输入转变为多个输入,即使用“颜色、线条和样式”的能力。作为参考,它指出文本装饰现在被认为是IE中不再支持的“速记属性”。更多信息可在我在文本中提供的链接上找到 我认为另一种选择是使用文本装饰风格,这是更具体的,应该得到支持
如果不是的话,我希望这是正确的。。我可以删除它:)IE 7在某些情况下实现了
文本装饰
错误:在内部元素上设置文本装饰:无
可能会阻止外部元素上设置的下划线显示在内部元素下。直观上可以理解,但不符合规范
作为一种解决方法,设置外部元素和内部元素的下划线
对于问题中混乱的代码,最起码的修复方法是添加以下CSS规则:
.main:hover a { text-decoration: underline !important; }
在此修复中,!重要信息
需要说明符,因为内部元素在样式
属性中设置了文本装饰。使用此选项:
text-decoration: underline !important;
IE7的使用是如此之少,我不担心。这并不直接适用,但它对类似的问题有一些评论| MDN页面对于浏览器支持信息非常混乱。当然,在一些CSS草稿中,速记的转化并没有改变IE7的工作方式!我只能希望如此,我只是不确定,但你似乎很好地解决了这个问题:)