本指南解决了将背景应用于 HTML 文档时的不同场景,阐明了特定行为发生的原因,并提供了实现所需背景效果的解决方案。
将背景应用于
body { background: #ddd url(background.png) center top no-repeat; }叠加背景要实现类似背景颜色与半透明图像叠加的效果,不需要使用单独的 元素。和<主体>元素。相反,结合使用背景颜色和背景图像属性:
html { height: 100%; background: #ddd url(background1.png) repeat; } body { min-height: 100%; background: transparent url(background2.png) center top no-repeat; }CSS2:
body { background: url(background2.png) center top no-repeat, #ddd url(background1.png) repeat; }CSS3:
以上是如何有效使用 HTML `` 和 `` 背景?的详细内容。更多信息请关注PHP中文网其他相关文章!