position的属性,以及简写

这篇文章详细介绍了CSS中用于设置元素背景的属性,包括背景颜色、图片、重复规则、位置、固定方式、尺寸、定位原点和绘制区域。这些属性允许开发者创建丰富的视觉效果。
摘要由CSDN通过智能技术生成

background-color:背景色

background-image:背景图片

background-repeat:背景图片重复规则

background-position:背景图片起始位置,默认0% 0%,可写top/center/bottom  left/center/right,只写一个的话第二个默认值为center。

background-attachment:背景图片是否固定或者是随页面其他部分滚动,可写fixed/scroller/inherit

background-size:背景图片的尺寸

background-origin:规定background-position属性相对于什么来定位,默认值padding-box,可选content-box/padding-box/border-box

background-clip:规定图片绘制区域,默认border-box,可选content-box/border-box/padding-box

background简写方式:

background: [background-color] [background-image] [background-repeat] [background-attachment] [background-position] / [background-size] [background-origin] [background-clip]

例如:

background: url("") no-repeat center center / 8.8vw 11.2vw;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值