html - 需要帮助解决 IE 8 z-index 工具提示

标签 html css tooltip

我的代码适用于 FF、Chrome,但不适用于 IE。问题是底部链接在工具提示中显示为多行。

这是我所有的代码(没有额外的 CSS)css:

CSS 文件

.hint,[data-hint] {
    position: relative;
    display: inline-block;}
.hint:before,.hint:after,[data-hint]:before,[data-hint]:after {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    z-index: 100000;
    pointer-events: none;}
.hint:hover:before,.hint:hover:after,.hint:focus:before,.hint:focus:after,[data-hint]:hover:before,[data-hint]:hover:after,[data-hint]:focus:before,[data-hint]:focus:after {
    visibility: visible;
    opacity: 1;}
.hint:before,[data-hint]:before {
    content: '';
    position: absolute;
    background: transparent;
    border: 6px solid transparent;
    z-index: 100001;}
.hint:after, [data-hint]:after {
    content: attr(data-hint);
    background: #FFFFFF !important;
    color: #fff;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 12px;
    width: 200px;
    white-space: pre-wrap;
    line-height:1.3em;
    text-align:center;
}
.hint--bottom:before {
  margin-top: -12px; }
.hint--bottom:after {
  margin-left: -18px; }
.hint--bottom:before, .hint--bottom:after {
  top:  100%;
  left: 15px;}
.hint--info:after {
color:#5B5957!important;
border:1px solid #335088;
-webkit-box-shadow: 0px 10px 20px 0px rgba(97,97,97,0.7);
-moz-box-shadow: 0px 10px 20px 0px rgba(97,97,97,0.7);
box-shadow: 0px 10px 20px 0px rgba(97,97,97,0.7);   
  }
.hint--info.hint--top:before {
  border-top-color: #335088; }
.hint--info.hint--bottom:before {
  border-bottom-color: #335088; }
.hint--info.hint--left:before {
  border-left-color: #335088; }
.hint--info.hint--right:before {
  border-right-color: #335088; }

我的 HTML 是:

<ul> 
<li>Features</li>
<li><a href="#" class="hint--bottom  hint--info" data-hint="test test  test test  test test  test test test test">Updates</a></li>
<li>Features</li>
<li><a href="#" class="hint--bottom  hint--info"  data-hint="awdawd">Examples</a></li>
<li><a href="#" class="hint--bottom  hint--info" data-hint="awdawd">Products</a></li>
</ul>

将市场视为红色图像 https://cloud.githubusercontent.com/assets/9686181/5025627/7e889594-6b23-11e4-9c95-89016aa0b29f.png

最佳答案

好的,您遇到的问题是 IE8(2009 年推出)上的 z-index 存在已知问题。

错误报告是here

所以首先我建议您升级您的浏览器,因为这个 IE 8 的浏览器市场份额很低 statistics for IE8 .

解决方法

根据我找到的信息,如果您简单地将 z-index 值从 10000 -> 10001 更改。到 10001 -> 10002 之间,这将解决您的问题。

谢天谢地,我没有 IE 8,而且我的 Browserstack 帐户正在运行,所以不幸的是我无法验证修复。但这应该给你足够的信息

关于html - 需要帮助解决 IE 8 z-index 工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26896398/

相关文章:

html - 在文本周围添加描边 - 在外面 - 使用 css?

JQuery Mobile 分组按钮宽度 - 使用 window.resize 跨越 100% 的 DIV

java - JTable 标题的每一列的工具提示文本

javascript - 获取CKEditor中选择的坐标

jquery - 带关闭按钮的工具提示

html - 更改了菜单栏颜色,现在将鼠标悬停在按钮上时无法再看到菜单

javascript - 如何使事件导航栏链接更改背景颜色? Bootstrap 4.

javascript - 如何使用 html、css 和 js 文件构建可在任何 Android 手机上运行的 APK 文件

javascript - 使用 javascript 应用属性时 CSS 属性选择器不起作用?

javascript - 如何使用 Javascript 使用每个元素自己的高度将 margin-bottom 添加到具有类的所有元素?