如何使平铺在网页中的所有元素的元素,而无需使用CSS背景属性

问题描述 投票:-2回答:1

我想瓷砖,通过它我想打印整个Web文档的图像。我已经使用背景属性瓦,但我必须设置的z-index属性,以使该图像放置在网页中的所有元素。帮我解决这个问题。

html css background-image
1个回答
0
投票

坚持到根的风格

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>

 :root 
   {
     background-image:url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQRxExzbsZCvO6lpE1tll_7pQLB5nd4RkWkrMannssfhAYni_Ct");
  opacity: .4; 
      }

</style>
</head>
<body>

<div id="overlay" onclick="off()"></div>

<div style="padding:20px">
  <h2>Overlay</h2>
  <p>Add an overlay effect to the page content (100% width and height with background with 40% opacity).</p>
  <button>some button here</button>
</div>

</body>
</html>
© www.soinside.com 2019 - 2024. All rights reserved.