Refer to the following code:
body {
height: 500px;
width: 80%;
margin-top: 0;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
padding: 0;
background-color: lightgray;
}
.header {
width: 80%;
height: 100px;
margin-left: auto;
margin-right: auto;
background-color: yellow;
/* border: solid 1px black; */
}
<div class="header">
<ul>
<li><a href="index.html">Dashboard</a></li>
</ul>
</div>
See Question&Answers more detail:os