简体   繁体   English

Internet Explorer 5不支持自动换行

[英]word-wrap an hover is not supporting in internet explorer 5

When I am mouse over on li elements the long content of li element should be wrap. 当我将鼠标悬停在li元素上时,应该包装li元素的长内容。 The following code is working in all the browsers except internet explorer 5. can you please help me to fix in ie5? 以下代码在除Internet Explorer 5之外的所有浏览器中均可正常工作。能否请您帮我修复ie5?

 <style type="text/css"> #breakText{ border: 1px solid #000; width: 200px; padding: 0px !important; } #breakText li{ margin: 0px !important; padding: 8px; margin: 48px auto 0; white-space: nowrap; overflow: hidden; <!-- text-overflow: ellipsis; --> display: block; } #breakText li:hover{ white-space: normal; background-color: yellow; } </style> 
 <html> <head> <script type="text/javascript" > </script> </head> <body> <ul id="breakText"> <li>This li contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line. </li> <li> thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.</li> </ul> </body> </html> 

IE 5 doesn't have the pseudo hover on elements other than the anchor tag "a". IE 5在锚标记“ a”以外的元素上没有伪悬停。

Also the "a" tag is selected only if it has an href attribute. 同样,只有具有href属性的“ a”标签才会被选中。 So you may want to try a simpler case where the hover is detected. 因此,您可能想尝试一种更简单的检测到悬停的情况。 Instead of changing text wrapping, let's do text color for now: 现在,我们不做文字换行,而是更改文字颜色:

<style>
li:hover{color:red;} /* won't work */
a:hover{color:red;} /* this works */
</style>

<li>this won't change</li>
<a href=# onclick="return false;">this will change on hover</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM