当前位置: 移动技术网 > IT编程>网页制作>CSS > css背景设置教程

css背景设置教程

2019年04月19日  | 移动技术网IT编程  | 我要评论

注:所有的代码都在 中实现

背景色

background-color:/*颜色*/;

背景图片

background-image:/*图片详情*/;

背景图片大小

background-size: ;

图片平铺(重复)

background-image: url(tupian.jpg);
background-repeat: no-repeat;/*此行表示不平铺*/

背景图片位置

background-position: ;
/*
传值
x y;xy可正可负

传关键字
x:
center 在中心
left   在左边
right  在右边
y:
top    在最上边
center 在中心
bottom 在最下边
如果只传一个值的话,另一个值默认为center
如果两个值都不写的话默认为0 0 
*/

背景图片滚动

background-attachment: scroll;
/*
scroll 背景图片跟随滚动条滚动(默认)
fixed  背景图片不会跟随滚动条而感动
*/

复合样式

background: ;
/*
例:background: green url(tupian.jpg) center;
*/

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网