Define element Background Settings Background-size Property cover Adaptive fill background, background-size:100% 100%; Background-size: Proportion of the upper and lower proportion;
A few more special attributes are introduced:
Background-clip:
Background-origin:
Background-size: Background size.
Background-break:
IE compatible background-size Add the following properties
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
src=‘http://img0.bdstatic.com/img/image/6992fdda3cc7cd98d10273a6b34233fb80e7aec90cc.jpg‘,
sizingMethod=‘scale‘);
——————————————————————————————————————————————————
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
title
>让IE兼容background-size的方法</
title
>
<
style
>
.bgpic {
background-image: url(‘http://img0.bdstatic.com/img/image/6992fdda3cc7cd98d10273a6b34233fb80e7aec90cc.jpg‘);
background-size: cover;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
src=‘http://img0.bdstatic.com/img/image/6992fdda3cc7cd98d10273a6b34233fb80e7aec90cc.jpg‘,
sizingMethod=‘scale‘);
}
</
style
>
</
head
>
<
body
>
<
div
class
=
"bgpic"
style
=
"width:200px;height:100px;"
></
div
>
</
body
>
</
html
>