<!DOCTYPE html>
<html lang="en">
<head>
<title>tested html</title>
<meta charset="utf-8">
</head>
<body>
<div id="outer-div" style="height:20em;background-color:red;">
<div id="inner_div" style="height:50%;margin-top:25%;margin-bottom:25%;">This the inner-div to be centered inside outer-div</div>
</div>
</body>
</html>
There are already many solutions to center(vertically only) a div inside another one, but i just wonder why the inner_div above cannot get centered in its parent div(outer-div)?
The picture below is the html rendering result from my opinion, but actually result is completely different -- the outer-div get pushed down by inner-div's margin settings. so why?