html - CSS 背景图像未按预期工作

标签 html css background background-image background-color

由于某些原因,通过 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/

相关文章:

javascript - VueJS不渲染表格数据

html - 处理距离其他元素类似的新元素 CSS

javascript - <td><span>course</span>English</td> 如何获取TD值NOT span值

javascript - 处理 IE 中的 JQuery/CSS 错误

css - 使用 css 更改表格行布局

css - 按钮点击 : hidden list

html - html/css可以调整定义列表的间距吗?

css - 是否可以在不同的部分重复一个带有 1 个背景图像的 div?

html - 为什么我的表格行没有正确对齐?

android - 如何检查Android OS 中哪个进程在后台运行?