html - 模糊除 div 中的一个元素之外的所有元素

标签 html css blur

我试图模糊 div 中除一个元素之外的所有元素。 我已经看过很多类似的问题 one我明白了:

.table-responsive:not(.confirm) {
    filter: blur(3px);
    pointer-events: none;
}

这基本上应该模糊除 confirm 类之外的所有元素。这是一个演示它的 js fiddle :https://jsfiddle.net/qbuyuhts/1/

这是一些简陋的 html,但可以显示问题。有谁知道为什么 .confirm div 是模糊的?

最佳答案

.table-responsive:not(.confirm) { selects element that have class .table-responsive and have not class .confirm this is wrong ,because .confirm is children of .table-responsive.

所以像这样更改您的代码:

.table-responsive table, .table-responsive div:not(.confirm) {
    filter: blur(3px);
     pointer-events: none;
}

.table-responsive table, .table-responsive div:not(.confirm) {
  filter: blur(3px);
  pointer-events: none;
}
<div style="border: none; overflow-x: visible;" class="table-responsive">

  <div style="background-color:white; width:35%; position:absolute; left:34%;" class="confirm">
    <h3 style="color:black">Are you sure?</h3>
    <button style="background-color:black;color:blue">Cancel</button>
    <button style="background-color:black;color:blue">Confirm</button>
  </div>

  <table id="tbl" style="width:100%">
    <tbody style="display: block; overflow-y: auto">
      <tr>
        <td style="padding-right:1em"><a class="remove"><button>Remove</button></a></td>
        <td style="padding-right:1em"><a><button>Edit</button></a></td>
        <td class="coursetext"><h4 align="left"><b>{{ course }}</b><br><span class="tohide"><b>{{ sections }}</b></span></h4><hr></td>
      </tr>
    </tbody>
  </table>
  
</div>

关于html - 模糊除 div 中的一个元素之外的所有元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45249817/

相关文章:

javascript - 在不提交表单的情况下触发自动完成

javascript - 如何在 firefox 中注入(inject) javascript 代码?

javascript - 如果输入在模糊时为空,请取消选中行复选框?

jquery - 计算每个鼠标滚轮滚动并输出到变量

javascript - 如何在悬停时模糊背景图像而不是文本

html - 我应该在网站的粘性页脚中使用什么 Font Awesome fa-icon-code css 类作为论坛链接?

html - 是否可以在非常特定的持续时间内播放HTML5音频元素(小于声音咬合的总持续时间)

javascript - 禁用文本选择,但允许剪切、复制和粘贴

jquery - Less\Sass\JQuery 中带有 HTML 参数的 CSS 类?

javascript - 动态改变 div 宽度 - 奇怪的问题