Html 左右两侧的背景图像
我怎样才能让它工作Html 左右两侧的背景图像,html,css,css-float,background-image,Html,Css,Css Float,Background Image,我怎样才能让它工作 <html> <head> <style type="text/css"> .left { float: left; background-image: url('image_with_variable_width.png'); background-repeat: repeat-y; } .right { float: right; background-image: url('image_with_variable_width_flip
<html>
<head>
<style type="text/css">
.left
{
float: left;
background-image: url('image_with_variable_width.png');
background-repeat: repeat-y;
}
.right
{
float: right;
background-image: url('image_with_variable_width_flipped.png');
background-repeat: repeat-y;
}
</style>
</head>
<body>
<div class="left"></div>
<div class="right"></div>
</body>
</html>
左边
{
浮动:左;
背景图片:url('image_with_variable_width.png');
背景重复:重复-y;
}
.对
{
浮动:对;
背景图像:url('image_with_variable_width_fliped.png');
背景重复:重复-y;
}
为div添加高度和宽度。如果div为空,则不会显示任何内容,因为它们的高度和宽度为零。要显示背景图像,请指定高度和宽度。到底什么不起作用?这实际上取决于(a)每个
中包含什么内容,以及(b)您最终想要它的外观。我不知道图像的宽度如果图像是动态的(例如,它们经常变化并且宽度不一致),然后,您可以设置固定的容器宽度,并使用css操纵背景图像的宽度:背景大小:200px 50px
(仅在CSS3中支持),您可以使用javascript获取宽度,然后以这种方式设置div的宽度,或者,您可以使用比图像大或小的固定列宽。