gpt4 book ai didi

css - 在 css 中声明带有 "background image"图像的 "height: auto"不显示

转载 作者:行者123 更新时间:2023-11-28 08:42:41 24 4
gpt4 key购买 nike

#test {background-image: url('/Skins/slickv2/csdlrsite/shared/1dpt_img_mainpic.png');
width: 200px;
height: auto;
background-repeat : no-repeat;}

这不是显示图像。但是如果我们将高度选项更改为某个值它正在工作,任何人都可以帮助我解决这个问题。

最佳答案

height:auto 会根据内容的高度自动调整 div 的大小。背景图像不是内容,因此 div 高度设置为 0。

关于css - 在 css 中声明带有 "background image"图像的 "height: auto"不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13840235/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com