我在设置div
背景图像的最大高度时遇到了一些问题。最大高度应该是图像的高度,不能大于此值。如果div
中的内容太多,它只是放大图片。当背景图像结束时,我希望它为我的其余内容继续使用背景颜色。这里是我试过的代码Div背景图像的最大尺寸
<style>
.profilbg {
background: url(<?php echo $uin->backgroundimg; ?>);
background-repeat: no-repeat;
background-size:cover;
}
.profilen {
width: 100%;
text-align: left;
clear: both;
}
</style>
<div class="profilen">
<div class="profilbg">
<?php echo nl2br($uin->profilen); ?>
</div>
</div>
有了这段代码,背景图片只是放大并且变大,如果内容太多的话。