x
 
<!DOCTYPE html>
<html>
<head>
<style> 
.a {
  background-color: lightgreen;
}
#b {
  width: 250px;
  height: 250px;
}
.c {
  width: 100px;
  height: 100px;
  border: 1px solid black;
  padding: 2px;
  mix-blend-mode: difference;
}
#d {
  isolation: auto;
}
</style>
</head>
<body>
<h1>通过 JavaScript 更改 isolation</h1>
<button onclick="myFunction()">试一试</button>
<p>点击“试一试”按钮可更改 div “d” 的 isolation 属性。</p>
<div id="b" class="a">
  <div id="d">
  <div class="a c">div d</div>
  </div>
</div>
<script>
function myFunction() {
  document.getElementById("d").style.isolation = "isolate";
}
</script>
<p><b>注释:</b>Internet Explorer 11 及更早版本不支持 isolation 属性。</p>
</body>
</html>