CSS3背景图片百分比及应用

1.background-size:100% auto,意思是背景图片宽度为元素宽度*100%,高度等比缩放。

2.等价写法

  • top left, left top 等价于 0% 0%.
  • top, top center, center top 等价于 50% 0%.
  • right top, top right 等价于 100% 0%.
  • left, left center, center left 等价于 0% 50%.
  • center, center center 等价于 50% 50%.
  • right, right center, center right 等价于 100% 50%.
  • bottom left, left bottom 等价于 0% 100%.
  • bottom, bottom center, center bottom 等价于 50% 100%.
  • bottom right, right bottom 等价于 100% 100%.

3.百分比计算公式

标准规定:background-position:perenct的参考值为: (容器宽度 - 背景图片宽度).

posted @ 2016-07-06 11:19  唯一的liaoliao  阅读(540)  评论(0编辑  收藏  举报