开发者

Does IE9 not allow margins of 0px around checkbox (radio) inputs?

开发者 https://www.devze.com 2023-03-27 06:23 出处:网络
I updated some of my CSS styles to use normalize.css recently but discovered an apparent inconsistency - it seems that in IE9 it won\'t let me set margins 0 around a checkbox element. But I couldn\'t

I updated some of my CSS styles to use normalize.css recently but discovered an apparent inconsistency - it seems that in IE9 it won't let me set margins 0 around a checkbox element. But I couldn't find any specific mention of the problem. Here's an example of my test. And here's a screenshot of what it looks like in Firefox, Chrome and IE9

Does IE9 not allow margins of 0px around checkbox (radio) inputs?

The reset styles are copy pasted from latest version of html5 boilerplate, which itself uses normalize.css by Nicolas Gallagher.

As I understood normalize.css, the idea is to keep some browser defaults but create a consistent layout for the components. However, from my quic开发者_如何学Pythonk testing, it looks like in fact there should not be a margin:0 around (checkbox/radio) inputs in order to create consistent layout, like so.

Having said that, smarter people than me worked on both normalize.css and html5 boilerplate, so either I'm missing something, or misunderstanding something.


IE9 adds padding. I guess that reset script doesn't take that into account. Add padding: 0 and you'll be set.


for my project I once rendered IE9 as IE8 by rendering it with meta tag of html

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>

so the same css worked for both

0

精彩评论

暂无评论...
验证码 换一张
取 消