Html 如何从右向左平铺背景图像
我有以下背景图像: 我想将其用作div的背景,但要放置在div的底部,并且只从左到右平铺,而不是从上到下平铺。此外,我希望div的背景颜色为Html 如何从右向左平铺背景图像,html,css,Html,Css,我有以下背景图像: 我想将其用作div的背景,但要放置在div的底部,并且只从左到右平铺,而不是从上到下平铺。此外,我希望div的背景颜色为#e4e5e6,这样颜色可以显示透明块所在的位置 这是我的开始: HTML 但是,这种方法将图像居中,并且仍然从上到下平铺。它也无法显示背景颜色。尝试将所有与背景相关的属性放入一个声明中,如下所示: .tiles { width: 100%; height: 400px; background: #e4e5e6 url('tiles
#e4e5e6
,这样颜色可以显示透明块所在的位置
这是我的开始:
HTML
但是,这种方法将图像居中,并且仍然从上到下平铺。它也无法显示背景颜色。尝试将所有与背景相关的属性放入一个声明中,如下所示:
.tiles {
width: 100%;
height: 400px;
background: #e4e5e6 url('tiles-bg.png') bottom left repeat-x;
}
对于背景友好,您应该使用以下内容:
background: #e4e5e6 url('tiles-bg.png') bottom left fixed repeat-x;
你看,属性“background”-是通用的,当你使用background color,然后在background之后,关闭background color的属性
.tiles {
width: 100%;
height: 400px;
background: #e4e5e6 url('tiles-bg.png') bottom left repeat-x;
}
background: #e4e5e6 url('tiles-bg.png') bottom left fixed repeat-x;