Css 身体上的2个背景:如何设置背景的高度
我有这个密码:Css 身体上的2个背景:如何设置背景的高度,css,background,Css,Background,我有这个密码: body{ margin: 0px; padding: 0px; background-image: url(images/header.png), url(images/footer.png); background-repeat: repeat-x, repeat; background-height: 50px , 400px; /* ?? */ background-position: 0% 0%, 0% 100%; }
body{
margin: 0px;
padding: 0px;
background-image: url(images/header.png), url(images/footer.png);
background-repeat: repeat-x, repeat;
background-height: 50px , 400px; /* ?? */
background-position: 0% 0%, 0% 100%;
}
我可以为footer.png指定一个在该特定高度重复的高度吗?
您可以尝试
背景大小
:
body{
margin: 0px;
padding: 0px;
background-image: url(images/header.png), url(images/footer.png);
background-repeat: repeat-x, repeat-x;
background-size: auto, auto 500px; // here give to background images height
background-position: 0% 0%, 0% 100%;
}
关于
背景大小的更多信息
我建议您创建单独的div并指定它
body {
margin: 0px;
padding: 0px;
background-image: url(images/header.png), ;
background-repeat: repeat-x;
background-height: 50px , 400px;
background-position: 0% 0%, 0% 100%;
div {
background-image: url(images/footer.png);
background-repeat: repeat;
background-height: 50px , 400px;
}
}
我不太明白。你说的“在那个特定高度重复”是什么意思?我的意思是第二张图像的高度是200像素或者什么的,但是我需要重复那个图像,但是当我重复的时候,这个图像会在整个身体上重复,我不需要:我需要背景在x 100%重复,然后是400像素或什么的,我希望我现在明白了:)你最好创建单独的div并设置背景图像并设置那个div的高度和宽度。这是CSS3属性I+9多个背景只支持IE9+HI Rohit,请考虑在答案中省去“…”,因为这会在帖子中产生很多噪音,其他人必须清理。而且,看起来好像有一个。避免这种情况的一种方法是停止添加点祝你好运欢迎@RohitAzad。此外,您的邮件中的“嗨”似乎也是导致您出现问题的原因。我发布的链接有更多关于为什么这种情况一直发生在你身上的细节。祝你好运!:)