什么是检测CSS3 背景大小支持的保存方式:封面,特别是在IE <9?
以下测试在IE <9中返回误报,因为它实际上设置了背景大小以涵盖:
div.style.backgroundSize = 'cover';
Run Code Online (Sandbox Code Playgroud)
测试时我得到的唯一真实结果:
if ('backgroundSize' in div.style)
Run Code Online (Sandbox Code Playgroud)
但根据现场http://www.standardista.com/css3/css3-background-properties/#bg11,IE 6/7/8应该返回汽车,仅覆盖和含有不被支持.
编辑:
我想使用我自己的解决方案,但我检查了Modernizr使用的代码.似乎他们使用相同的技术,在IE <9中设置假阳性结果:设置backgroundSize ='cover',然后检查style.backgroundSize =='cover'.
看我的JSFiddle.