Here's a CSS question, if we put margin: auto
in normal flow, only left and right margin space being averaged. However, if we put 'margin: auto` to a flex item, the item centered on both horizontal and vertical, why is it?
Heres the code:
#one {
width:300px;
height:300px;
border:solid 2px black;
margin:auto;
display:flex;
}
#two {
width:100px;
height:100px;
background:red;
margin:auto;
}
<div id = "one">
<div id ="two"></div>
</div>
Looking forward to any input!