在Web浏览器的上下文中,Render Tree仅包含将在网页上可见的元素。因此,具有display: none
的元素不会进入渲染树。但是我知道渲染树中包括了像height: 0
和position : absolute; left: 100%
这样的元素,即使它们在渲染时在网页上也不可见。那么为什么这些元素仍包含在渲染树中?
.no-height {
height: 0;
};
.absolute {
position: absolute;
}
<div class="no-height">
<p class="absolute">still here</p>
</div>
.no-height {
height: 0;
border: 5px solid;
margin: 120px;
};
<div class="no-height">
</div>
I should be at top
.no-height {
height: 0;
};
<div>
some inline<div class="no-height"></div>text
</div>