body{background:url(图片) repeat}
背景{}中添加background: url(图片地址)repeat
详细讲解:
repeat 背景图像在纵向和横向上平铺
no-repeat 背景图像不平铺
repeat-x 背景图像在横向上平铺
repeat-y 背景图像在纵向平铺
repeat:3/*重复3次*/
注意:只能在原图的基础上进行重复!而不能像我们的桌面一样进行扩大填充。
代码如下:
默认代码为:
body{background-color:#FFFFFF}
换成以下代码 body{background:url(背景图片地址) background-position: center;background-attachment: fixed;repeat-x #FFFFFF}
这是全屏的背景代码~
在ASP.NET中把背景图片拉伸
body
{
background-image:url('a.jpg');
background-repeat:repeat
}
body{background:#FFF url(背景图片地址) no-repeat 50% 0;}
no-repeat不重复
50% 0(水平位置 垂直位置) 水平50%既居中,垂直0px
center 也可
DIV+CSS如何让图片文字混排的情况下垂直居中
<style>
div{padding:40px 0px 40px 0px;border:1px solid #ccc;}
</style>
<div>
测试一下
</div>