Kae*_*aeL 24 css css3 flexbox internet-explorer-11
我有这个简单的div,里面有一个按钮.justify-content: center;
使用Firefox和Chrome工作正常,但在IE 11上不起作用:
#div {
height: 200px;
width: 50px;
border: 1px solid black;
display: flex;
flex: 0 0 auto;
align-items: center;
justify-content: center;
}
#button {
height: 50px;
width: 200px;
min-width: 200px;
border: 1px solid black;
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
<div id="div">
<button id="button">HELLO</button>
</div>
Run Code Online (Sandbox Code Playgroud)
我的目标是,当我用transform
同rotate(90deg)
或rotate(270deg)
,该按钮就会融入DIV:
#div {
height: 200px;
width: 50px;
border: 1px solid black;
display: flex;
flex: 0 0 auto;
align-items: center;
justify-content: center;
}
#button {
height: 50px;
width: 200px;
min-width: 200px;
border: 1px solid black;
background-color: red;
transform: rotate(90deg);
}
Run Code Online (Sandbox Code Playgroud)
<div id="div">
<button id="button">HELLO</button>
</div>
Run Code Online (Sandbox Code Playgroud)
该height
和width
的div
和button
始终是相同的,但是是可定制的.
尽可能地,我不喜欢包裹元素.
mis*_*Sam 48
IE11需要父母拥有flex-direction: column
.
此示例将您的按钮旋转:
#div {
height: 200px;
width: 50px;
border: 1px solid black;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column
}
#button {
height: 50px;
width: 200px;
min-width: 200px;
border: 1px solid black;
background-color: red;
transform: rotate(90deg);
}
Run Code Online (Sandbox Code Playgroud)
<div id="div">
<button id="button">HELLO</button>
</div>
Run Code Online (Sandbox Code Playgroud)