After using margin: auto
to center my flexbox horizontally on the webpage, I am struggling to vertically center it as well.
As a CSS beginner, I would appreciate any help. Thank you.
.container {
background-image: url(paperbackground.jpg);
color: #D64933;
margin: auto;
width: 500px;
}
.box {
align-content: center;
display:flex;
font-family: Arial, Helvetica, sans-serif;
font-size: 25px;
font-weight:bold;
justify-content: center;
padding: 2px;
}
<div class="container">
<ul>
<!--Below is an unordered list.-->
<div class="box"><li>Video Games</li></div>
<div class="box"><li>Watching technology, hacking and other documentaries.</li></div>
<div class="box"><li>Chess</li></div>
<div class="box"><li>Cricket</li></div>
</ul>
</div>