调整背景图片的位置,居中,靠左,靠右等(background |
您所在的位置:网站首页 › html图片居右怎么设置 › 调整背景图片的位置,居中,靠左,靠右等(background |
一、语法
语法:background-position:x, y; 定义:背景图片相对容器原点的起始位置; 取值: 关键字:top | center | bottom | left | center | right 百分比:百分数 具体值:px、rem、em等确值 默认值为:0% 0%(即坐标原点) 二、定位原理
例子: 换算关系:关键字 -> 百分比 -> px(or rem em等) 1、关键字 -> 百分比 center -> 50% left top -> 0% right bottom -> 100% 2、百分比 -> px (容器(container)的size — 背景图片的size) * 百分比 如:background-position: a% b%; 换算: x = (containerWidth - bgWidth) * a% y = (containerHeight - bgHeight) * b% |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |