【发布时间】:2021-07-23 06:50:50
【问题描述】:
我无法将重复图像缩放到 html 中文档的高度。 我可以清楚地看到使用检查器的 html 元素有多大。
我已将 div 的高度设置为 100rem,这应该将其缩放为根元素高度的 100%(据我所知是 html 元素)。
CSS:
#left-buildings{
left: 0;
float:left;
}
.buildings{
height: 100rem;
position: absolute;
width: 5%;
top: 0;
background-image: url(../media/images/city-side-seamless.png);
background-repeat: repeat-y;
background-size: contain;
}
HTML:
<div class="buildings" id="left-buildings"> </div>
<div class="buildings" id="right-buildings"> </div>
问题是,它没有缩放到正确的大小。
screenshot showing that the element is not spanning the height of the page
【问题讨论】:
-
1 rem 表示默认字体大小。在大多数浏览器中,1 rem 默认为 16px。
-
所以我认为你的意思是 100vh。
-
哦,是的,我的坏XD。
标签: html css css-selectors