码迷,mamicode.com
首页 > 其他好文 > 详细

背景图片相关设置

时间:2018-05-17 17:24:57      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:关键字   gif   unit   href   水平   translate   nbsp   att   top   

body

background-image:url(‘smiley.gif‘);//图片地址
background-repeat:no-repeat;//是否重复
background-attachment:fixed;//网页滚动时,背景图片是否跟着滚动
background-position:center; 
}

background-attachment

scroll:默认值。背景图像会随着页面其余部分的滚动而移动。

fixed:当页面的其余部分滚动时,背景图像不会移动。

inherit:规定应该从父元素继承 background-attachment 属性的设置。

演示地址:http://www.w3school.com.cn/tiy/t.asp?f=csse_background-attachment

 

background-position:

描述
left top
left center
left bottom
right top
right center
right bottom
center top
center center
center bottom
如果仅指定一个关键字,其他值将会是"center"
x% y% 第一个值是水平位置,第二个值是垂直。左上角是0%0%。右下角是100%100%。如果仅指定了一个值,其他值将是50%。 。默认值为:0%0%
xpos ypos 第一个值是水平位置,第二个值是垂直。左上角是0。单位可以是像素(0px0px)或任何其他 CSS单位。如果仅指定了一个值,其他值将是50%。你可以混合使用%和positions
inherit 指定background-position属性设置应该从父元素继承

背景图片相关设置

标签:关键字   gif   unit   href   水平   translate   nbsp   att   top   

原文地址:https://www.cnblogs.com/cowboybusy/p/9052058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!