css 设置背景图一半_html+css-->background-img(背景图的设置)

背景图

/*图片可更改*/background-image:url(img/shoucang.png);

/*从父元素继承属性的设置*/background-repeat-x:inherit;

}.boxrepeat{

/*取消默认平铺*/background-repeat:no-repeat;

/*横向平铺*/background-repeat:repeat-x;

/*纵向平铺*/background-repeat:repeat-y;

}.boxsize{

/*背景图片的尺寸:px、百分比--依旧会默认平铺元素*/background-size:30px;background-size:50%;

/*图片的覆盖cover--等比放大覆盖整个元素*/background-size:cover;

/*背景图片的包含contain--在取消默认平铺的情况下,将图片等比放大直到图片的一边到达元素的边框*/background-repeat:no-repeat;background-size:contain;

}.boxattachment{

/*图片的固定--scroll:随着页面其余部分的的滚动而移动*/background-attachment:scroll;

/*图片的固定--fixed背景不会随着滚轮移动 但是元素会移动并且对图片进行一部分的覆盖*/background-attachment:fixed;

}.boxposition{

/*背景图片的定位--x:left y:top 位于左边顶部*/background-repeat:no-repeat;

/*background-position: left top;*/

/*背景图片的定位--x:25px y:50px 向右偏移25px 向下偏移50px*/background-position:25px 50px;background-position:right bottom;

/*背景图片的定位--center 居中*/background-position:center;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值