justify-content
和align-items
使用center似乎无法在IE 11中正常工作。在其他浏览器中,它的工作与我期望的一样。有人知道解决方法吗?
.box {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}
.score-wrapper {
align-items: center;
display: flex;
justify-content: center;
min-height: 280px;
}
.overlay-circle {
border-radius: 100px;
border: 1px solid red;
fill: transparent;
height: 200px;
position: absolute;
width: 200px;
}
.center-circle {
border-radius: 90px;
border: 1px solid blue;
height: 180px;
position: absolute;
width: 180px;
}
<div class="box">
<div class="score-wrapper">
<div class="overlay-circle"></div>
<div class="center-circle">
<div class="score">
<p>800</p>
<p>Excellent</p>
</div>
</div>
</div>
答案 0 :(得分:4)
这就是说,为IE11在.score-wrapper
上添加一个明显的高度作为后备。
.box {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
}
.score-wrapper {
align-items: center;
display: flex;
justify-content: center;
min-height: 280px;
height: 280px;
}
.overlay-circle {
border-radius: 100px;
border: 1px solid red;
fill: transparent;
height: 200px;
position: absolute;
width: 200px;
}
.center-circle {
border-radius: 90px;
border: 1px solid blue;
height: 180px;
position: absolute;
width: 180px;
}