六.background-position:-50% -50%;。 等同于left:-{{容器(container)的宽度—背景图片的宽度}*left百分比(百分比都取正值)},超出的部分隐藏。等同于 right:-{{容器(container)的高度—背景图片的高度}*right百分比(百分比都取正值)},超出的部分隐藏。 总结:利用div大小和十字架原理,可以用background-position属...
等同于right:{容器(container)的高度—背景图片的高度}*right百分比,超出的部分隐藏。 六.background-position:-50% -50%;。 等同于left:-{{容器(container)的宽度—背景图片的宽度}*left百分比(百分比都取正值)},超出的部分隐藏。等同于 right:-{{容器(container)的高度—背景图片的高度}*right百分比(百分比都...
单位可以是长度px,关键字和百分数值 关键字成对出现left right top bottom center,如果仅指定一个关键字,其他值将会是"center" x% y%第一个值是水平位置,第二个值是垂直。左上角是0%0%。右下角是100%100%.如果仅指定了一个角,其他值将是50%,默认0%0% 5.background-attachment背景关联 设置背景图像是否...
background-position是用于定位背景图片中对象中显示定位,比如图片作为背景时在对象内什么位置开始显示,显示样式等。比如让一个图片作为对象背景距离对象左边或右边多少间距开始显示,距离对象上边或下边多少间距开始显示,或者用常见left、right、center代表水平左、中、右显示图片,或者常见bottom、top代表下部(底部)、上部(顶...
position : top | center | bottom | left | center | right 说明: 设置或检索对象的背景图像位置。必须先指定 background-image 属性。 该属性定位不受对象的补丁属性( padding )设置影响。 默认值为: 0% 0% 。此时背景图片将被定位于对象不包括补丁( padding )的内容区域的左上角。
div{ width: 500px; height: 500px; border:1px solid red; background-image:url(images/king1.jpg); background-repeat: no-repeat; } .box1{ background-position: right bottom; } .box2{ background-position: right 50px bottom 100px; } .box3{ background-position...
right bottom center top center center center bottom 如果仅指定一个关键字,其他值将会是"center" x% y% 第一个值是水平位置,第二个值是垂直。左上角是0%0%。右下角是100%100%。如果仅指定了一个值,其他值将是50%。 。默认值为:0%0% xpos ypos 第一个值是水平位置,第二个值是垂直。左上角是0...
一、关键字(top、bottom、left、right、center) 1. 两个值 background-position可以取两个值,一个为横轴方向,一个为纵轴方向。 比如你想要把背景图定位在右下角,只需这样写: 代码语言:javascript 代码运行次数:0 复制 Cloud Studio代码运行 background-position:right bottom; ...
一、关键字(top、bottom、left、right、center) 1. 两个值 background-position可以取两个值,一个为横轴方向,一个为纵轴方向。 比方你想要把背景图定位在右下角,只要这样写: 1 background-position: right bottom; So easy! 当然你也阔以把顺序反过来,丝毫没影响! 1 background-position: bottom right; ...
语法:background-position : length || length background-position : position || position取值:length : 百分数 | 由浮点数字和单位标识符组成的长度值。请参阅 长度单位 position : top | center | bottom | left | center | right说明:设置或检索对象的背景图像位置。必须先指定 background-image 属性。 该...