码迷,mamicode.com
首页 > Web开发 > 详细

CSS之 background-size

时间:2019-06-10 17:05:20      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:pad   scale   document   ado   set   size   fixed   fine   diff   

https://developer.mozilla.org/en-US/docs/Web/CSS/background-size

 

The background-size CSS property sets the size of the element‘s background image. The image can be left to its natural size, stretched, or constrained to fit the available space.

 

comma.

Values

contain
Scales the image as large as possible without cropping or stretching the image.
cover
Scales the image as large as possible without stretching the image. If the proportions of the image differ from the element, it is cropped either vertically or horizontally so that no empty space remains.
auto
Scales the background image in the corresponding direction such that its intrinsic proportions are maintained.
<length>
Stretches the image in the corresponding dimension to the specified length. Negative values are not allowed.
<percentage>
Stretches the image in the corresponding dimension to the specified percentage of the background positioning area. The background positioning area is determined by the value of background-origin (by default, the padding box). However, if the background‘s background-attachment value is fixed, the positioning area is instead the entire viewport. Negative values are not allowed.

CSS之 background-size

标签:pad   scale   document   ado   set   size   fixed   fine   diff   

原文地址:https://www.cnblogs.com/eddyz/p/10998738.html

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