CSS divs width 50% not working in IE

2019-06-09 04:15发布

I'm unable to get this working in IE, the second child doesn't remain in the same line.

HTML:

<div class="outer">
  <div class="inner">left</div>
  <div class="inner">right</div>
</div>

CSS:

.outer
{
  width: 100%;
}

.inner
{
  float: left;
  width: 50%;
}

3条回答
对你真心纯属浪费
2楼-- · 2019-06-09 04:18

Change your width's to 49% (or one to 50% and the other to 49%).

查看更多
霸刀☆藐视天下
3楼-- · 2019-06-09 04:32

Change it to width: 49.9%. Well documented bug in IE.

查看更多
做自己的国王
4楼-- · 2019-06-09 04:39

if you have a set width in px, 50% works correctly.

CSS:

.outer{
width: 900px;
} 
.inner{
width: 50%
}
查看更多
登录 后发表回答