CSS背景图像未展开
我使用10x400像素的图像作为背景图像,css如下:CSS背景图像未展开,css,Css,我使用10x400像素的图像作为背景图像,css如下: body { background-image:url('bg1.png'); background-repeat:repeat-x; text-align: center; background-size:100% 100%; } 在chrome中,图像在chrome中扩展到屏幕的整个高度,但在firefox或IE中没有。帮助???尝试使用以下命令使其垂直和水平重复 background-repeat: repe
body {
background-image:url('bg1.png');
background-repeat:repeat-x;
text-align: center;
background-size:100% 100%;
}
在chrome中,图像在chrome中扩展到屏幕的整个高度,但在firefox或IE中没有。帮助???尝试使用以下命令使其垂直和水平重复
background-repeat: repeat
尝试将
min height
添加到html
。
不要认为
背景重复:如果使用背景大小:100%100%
,则需要重复-x
。我不希望它沿着高度重复,因为它有一个梯度,会给人留下一个不好的条纹。我将身体从最小高度部分移除后,它工作正常。否则对于chrome来说,随着屏幕的增加,它会给我一个滚动条
html{
min-height: 100%;
}
body {
background-image: url('path_to_img.png');
text-align: center;
background-size: 100% 100%;
}