我试图强制BODY
元素的伪元素始终为Document
(非窗口)的100%高度。
position
的伪元素必须不能设置为FIXED
我搜索了堆栈溢出并找不到答案。 谢谢!
答案 0 :(得分:1)
尝试:
html {height: 100%;}
body {min-height:100%;}
然后是您现有的代码:
body{ position:relative; }
p{ width:15%; padding:10px; }
body::before {
background: red;
content: "";
height: 100%;
width: 100%;
opacity: 0.2;
pointer-events: none;
position: absolute;
top: 0;
left: 0;
}