My struggle lies in centering the ul
element which serves as a menu. Despite trying various CSS properties such as margin: 0 auto;
, text-align: center;
, and adjusting the margin
value, I am unable to achieve the desired result.
This is the CSS code I have:
html {
font-family: 'Exo';}
body {
background: #1a1a1a;}
.nav {
margin-left: 50%;}
.nav li {
display: inline-block;
color: white;
padding: 15px;
margin-left: 10px;
border: 3px solid #2E9FFF;
text-align: center;
width: 225px;
background-color: DodgerBlue;
font-size: 200%;
transition: ease 0.5s;
text-decoration: none;}
.nav li:hover {
cursor: pointer;
border: 3px solid #2E9FFF;
border-radius: 50px;
background-color: #1a1a1a;}
.nav li a {
text-decoration: none;
color: white;}
This is the HTML code I have:
<ul class="nav">
<li><a href="#">Najdi si hru</a></li>
<li><a href="#">Jaký je náš cíl?</a></li>
<li><a href="#">Kontakt</a></li>
</ul>