【问题标题】:CSS popup div unclickable background content, work only in ie8?CSS popup div 不可点击的背景内容,只能在 ie8 中使用?
【发布时间】:2014-03-28 22:41:28
【问题描述】:

在问这个问题之前,我看到了这个问题:CSS background opacity with rgba not working in IE 8 但对我没有用。我只使用 css 制作一个弹出窗口。它适用于 ie9+ 和 mozilla25+ 我用来执行此操作的 css: HTML:

<div id="backgroundFilter">
    <div id="overBackgroundFilter"></div>
</div>

#backgroundFilter 
{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(184, 184, 184, 0.5);
}

#overBackgroundFilter 
{
position: static;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
height: 385px;
width: 400px;
background-color: #F8F8F8;
border-width: 6px;
border-color: #E0E0E0;
border-style: solid;
}

我将我的 css 更改为 ie8,它适用于 ie8,但不适用于 mozilla。在 mozilla 中,不透明度从 backgroundFilter 传递到 overBackgroundFilter,我希望只有 backgroundFilter 是透明的,而 overBackgroundFilter 不是。有任何想法吗?这是为 ie8 更改的 css:

#backgroundFilter 
{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #B8B9BB;
-moz-opacity: 0.50;
opacity: 0.50;
filter: alpha(opacity =50);
}

#overBackgroundFilter 
{
position: absolute;
display: block;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
height: 385px;
width: 400px;
background: #F8F8F8;
border-width: 6px;
border-color: #E0E0E0;
border-style: solid;
}

谢谢!

【问题讨论】:

  • 能否请您创建一个 jsFiddle 或展示其他现场演示?
  • 现在,我不明白你的问题,你的小提琴在 Chrome、Safari、Firefox、IE11 和 IE8 中看起来完全一样(如果我添加了我建议的过滤器)。这是更新的小提琴 - jsfiddle.net/HjJB6/4 和我比较的演示链接 fiddle.jshell.net/HjJB6/4/show
  • 我不知道为什么不在我的项目中使用您的 ie8 代码!我尝试修复它,但我有同样的问题...在 ie8 中工作,而不是在 mozilla 或vicevera 中工作。也许是我项目中的其他东西!非常感谢
  • 我修复了它,像这样检查浏览器:if(explorer){change div id}else{other div id}。我尝试通过css修复但不起作用!如果我在资源管理器中仅使用该代码但在我的项目中不起作用,您的代码就可以了!感谢您的宝贵时间!

标签: css internet-explorer


【解决方案1】:

考虑使用

#backgroundFilter {
  ...
  background: rgba(184, 184, 184, 0.5);
  filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#7FB8B8B8', endColorstr='#7FB8B8B8'); /* IE8 */
}

这里有类似的问题CSS background opacity with rgba not working in IE 8

这是带有该修复程序的 jsFiddle - jsfiddle.net/HjJB6/4。这是一个可用于 IE8 fiddle.jshell.net/HjJB6/4/show 的演示链接(jsFiddle 主页面不支持 IE8)。

【讨论】:

  • 我看到了这个问题,但它对我不起作用,因为在 ie8 中我的 backgroundFilter div 没有不透明度!在 Mozilla 中为 rgba(184, 184, 184, 0.5) 工作;看来,如果我对我的 css 作品或 ie8 或 mozilla 进行更改!
猜你喜欢
  • 2019-12-09
  • 1970-01-01
  • 2011-01-07
  • 2017-08-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多