Good morning everyone.I want to try to tell you about my flexbox problem. I searched a lot on the internet (some days), maybe i maybe i was looking badly on the google ? but unfortunately I did not find the answer to my question. My problem is that when I want to apply persistence align-items: center;
for flexbox, it doesn't work. I just want it to auto-center, both horizontally and vertically.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"> <title>flex-box</title>
<link rel="stylesheet" href="css/flex.css">
</head>
<body>
<div class="header">
<div class="align-header">
<nav class="navigation">
<ul class="my-ul-links">
<li class="link"><a href="#">Home</a></li>
<li class="link"><a href="#">Forum</a></li>
<li class="link"><a href="#">Catalog</a></li>
</ul>
</nav>
</div>
</div>
<div class="wallpaper"></div>
</body>
</html>
I even went to the official documentation MDN but unfortunately, I didn’t find there how to use flexbox
together with the tag nav
and ul
, nested in li
+ a
. Very weird. Maybe I don't understand something.
* {
margin: 0px;
padding: 0px;
}
body {
background-color: #eee;
}
.header {
background: white;
width: 100%;
height: 50px;
}
.align-header {
width: 800px;
height: 100%;
margin: 0px auto 0px auto;
}
.my-ul-links {
display: flex;
justify-content: center;
align-items: center; /* does not working */
}
.link {
padding: 0px 10px 0px 10px;
}
li {
list-style: none;
}
a {
text-decoration: none;
}
I will be very grateful if you can help me with this problem. Thank for early.