首页 > 解决方案 > 如何仅使用css模糊除目标上的div以外的整个身体?

问题描述

我正在尝试做

<!DOCTYPE html>
<html>

<head>
    <title>TEST</title>
    <style>
     :not(:target) {
        filter: blur(5px);
    }
    </style>
</head>

<body>
    <a href="#test">test</a>
</body>

</html>

但即使当我瞄准(点击)我的测试时,它也会变得模糊。

标签: htmlcss

解决方案


试试这个:

body :not(:target) {
  filter: blur(5px);
}

body :not(:target) {
  filter: blur(5px);
}
<a href="#test">test</a>
<p id="test">This is Target</p>
<p>This is'nt Target</p>


推荐阅读