How can I make the output/result of the below HTML to the center of the page ? ie, the output must be aligned both Horizontally and vertically center of the web/html page using css !! I tried with below code. But not working properly. The output box is only aligned horizontally centered. Vertical aligned is not happening. please help.
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 16px;
text-decoration: none;
}
.container ul li {
vertical-align: middle;
}
li a:hover {
background-color: Red;
}
#container {
text-align: center;
}
ul {
display: inline-block;
}
<div id="container">
<ul>
<li><a href="#home">Apple</a></li>
<li><a href="#home">Banana</a></li>
<li><a href="#home">Mango</a></li>
<li><a href="#home">Grapes</a></li>
</ul>
</div>