由于某些原因,通过 background
设置的图像背景不起作用。
Chrome 和 Firefox 中的开发者工具都显示图像背景设置和图像链接有效,但由于某种原因没有显示。
.footer-mold {
background: url('http://www.example.com/images/footer-bg.jpg') no-repeat left top;
}
这是网站的链接 - https://www.pamoldremoval.com/blog/ .
最佳答案
.footer-mold
的高度为 0,因为里面的所有东西都是 float 的,你什么都没有清除。
一个解决方案是添加
.footer-mold::after {
clear: both;
display: block;
content: '';
}
到样式表。
关于html - CSS 背景图像未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56514765/