I can't apply the first-child selection to my "a" tag. What could be the cause of the problem? I shared my codes in the link below.
My HTML CODE
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header id="header">
<div class="header-row">
<div class="navbar">
<ul class="menu">
<li class="menu-item"><a href="#" class="menu-item-link">Menu 1</a></li>
<li class="menu-item"><a href="#" class="menu-item-link">Menu 1</a></li>
<li class="menu-item"><a href="#" class="menu-item-link">Menu 1</a></li>
<li class="menu-item"><a href="#" class="menu-item-link">Menu 1</a></li>
</ul>
</div>
</div>
</header>
</body>
</html>
MY CSS CODE
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
ul{
list-style: none;
}
a{
text-decoration: none;
}
.header-row{
width: 1100px;
height: 70px;
background-color: #121454;
margin: 0 auto;
}
ul.menu{
display: flex;
flex-wrap: wrap;
}
a{
display: block;
color: #fff;
padding: 20px;
height: 100%;
}
ul li a:first-child{
background-color: #fff; /* not working*/
}
Applies to all my "a" tags other than the first effect I can speak English a little. Thank you everyone