When I try putting the padding property of a child element put inside a parent which is also a child but this time its parent is a flexbox, when I try putting the padding in percentages, it doesn’t make the parent accommodate the increase in the size and so pushes the content outside the parent. Why is that?
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="assign6">
<nav>
<ul class="links">
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Contact</li>
</ul>
</nav></div>
</body>
</html>
:root {
--backgroundColor: #ddd;
}
.assign6 nav {
background-color: var(--backgroundColor);
width: 85%;
padding: 1%;
display: flex;
justify-content: flex-end;
}
.assign6 nav ul {
display: flex;
padding-left: 0px;
margin: 0px;
justify-content: flex-end;background: blue;/* width: 50%; */color: white;}
.assign6 nav ul li{
list-style: none;
padding: 0px 6%;
}