I tried applying padding only to the item4 but it also got applied to the item3 and the text inside the item3 is also not centered as i expected it to be.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="flexbox.css">
<title>flexbox</title>
</head>
<body>
<div class="container">
<div class="container2">
<p class="item1">item1</p>
<p class="item2">item2</p>
</div>
<div class="container2">
<p class="item3">item3</p>
<p class="item4">item4</p>
</div>
</div>
</body>
</html>
--------------------------------------///css//------------------------------------------------------
.container{
border: 1px solid black;
background-color: rgb(255, 157, 0);
display: flex;
align-items: center;
justify-content: space-between;
padding-inline:1rem;
}
.container2{
display: flex;
gap: 2em;
}
.container2 p{
background-color: blue;
border: 1px solid black;
}
.item4{
padding:1rem;
}
I tried applying padding only to the item4 but it also got applied to the item3 and the text inside the item3 is also not centered as i expected it to be.