这让我疯狂。它在Chrome中工作,我也需要它在IE中工作。 https://jsfiddle.net/h18uwtsf/1/居中CSS不能在Internet Explorer 11中工作
我的HTML
<div id="q-numbers">
<div>Defect Incident as of <span id="qval1"></span></div>
<div class="table">
<div>
<div>Days since last escape</div>
<div>Best Streak
<br/>(since 4/5/16)</div>
</div>
<div>
<div class="square orange"><span id="qval2">23</span></div>
<div class="square blue"><span id="qval3">44</span></div>
</div>
</div>
</div>
我的CSS
#q-numbers > div:first-child {
font-weight: bold;
font-size: 1em;
margin: 10px 10px;
}
#q-numbers .table {
display: table;
width: 100%;
border-spacing: 10px;
}
#q-numbers .table > div {
display: table-row;
}
#q-numbers .table > div > div {
display: table-cell;
width: 50%;
position: relative;
}
#q-numbers .table > div > div > div {
padding: 4px 0px;
}
#q-numbers .blue,
#q-numbers .orange {
background-color: #ccc;
border-top: 1px solid #707376;
border-bottom: 1px solid #707376;
height: 80px;
}
#q-numbers .square span {
height: auto;
border-spacing: 10px;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%) scale(1, 1);
transform: translate(-50%, -50%) scale(1, 1);
-webkit-transform: translate(-50%, -50%) scale(1, 1);
font-size: 3.5vw;
}
#q-numbers .footer {
background-color: #eee;
text-align: center;
padding: 5px 0px;
}
我上面获得可以在我的jsfiddle待见,但数量应该在灰色框中央的结果。在IE浏览器中,它们出现在顶端的一半。
请仔细阅读并在我的答案发表评论,让我知道,如果事情是不明确或缺少。如果你能接受最能帮助你的答案,那也将是一件好事。 – LGSon