我正在做一些IE8的高级测试,似乎使用margin: 0 auto;
的旧技术并不能在IE8中的所有情况下都起作用.
以下HTML提供了FF3、Opera、Safari、Chrome、IE7和IE8 Comat格式的居中按钮,但IE8标准格式为NOT:
<div style="height: 500px; width: 500px; background-color: Yellow;">
<input type="submit" style="display: block; margin: 0 auto;" />
</div>
(作为一种变通方法,我可以为按钮添加明确的宽度).
所以问题是:哪些浏览器是正确的?或者这是行为不明确的 case 之一?
(我的 idea 是all%浏览器是错误的——如果按钮是"显示:块",那么按钮不应该是all%宽度吗?)
UPDATE: I'm being a dunce. Since input isn't a block-level element, I should have just contained it within a div with "text-align: center". Having said that, for curiosity's sake, I'd still like to know whether the button should or shouldn't be centered in the example above.个
FOR THE BOUNTY: I know I'm doing odd things in the example, and as I point out in the update, I should have just aligned it center. For the bounty, I'd like references to the specs that answer:
If I set "display: block", should the button be width 100%? Or is this undefined?
一百