I have tried so many things and am still a beginner to HTML and CSS, was wondering if anyone knows why the list is not centering in the navbar.
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css2?family=Merriweather+Sans&display=swap" rel="stylesheet">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<div class="bar">
<ul class="words">
<li class ="Keyboards">Keyboards</li>
<li class ="Accessories">Accessories</li>
<li class ="In_Stock">In Stock</li>
<li class ="Group_Buy">Group Buy</li>
<li class ="Support">Support</li>
</ul>
</div>
</head>
<body>
</body>
</html>
*{
margin: 0;
padding: 0;
}
body{
background-color: rgb(41, 41, 41);
font-family: 'Merriweather Sans', sans-serif;
font-style: bold;
}
.bar{
background-color: rgb(69, 69, 69);
height: 75px;
}
li{
display: inline-block;
padding-left: 10px;
padding-right: 10px;
font-size: 25px;
margin: auto;
}
I have tried lots of margins and display flex. Still nothing that works
2
Answers
try this:
you can change the
width
of the ul element with the classwords
.Please try to follow these instructions.
https://futureminutes.com/answers/list-is-not-centering-in-html-10353
if you are still unable to fix it, let me know, we can do google meet, I will try to assist, you.