My expectations for the following HTML document were to see a red square vertically centered within a yellow square:
<html>
<body>
<div style="width:200px;height:200px;background-color:yellow">
<div style="width:100px;height:100px;background-color:red;vertical-align:middle">
</div>
</div>
</body>
</html>
However, the result showed that it was aligned to the top of its parent div.
I'm puzzled as to what went wrong. Why isn't vertical-align:middle
functioning as expected?