When I try to put 5 inline div blocks with a width of 20% with 1px borders, inside the containing div, also with a 1px border, they wrap to the next line.
They are suitable if I get rid of all boundaries.
I understand that this is due to the fact that divs occupy 100% of the div area, including the fill area and borders, which means that they do not correspond to the borders inside , so it should wrap.
My question is how to change this so that I can accurately select them. Surely this is a common problem?
<html>
<head>
<title> Test </title>
<style type=text/css>
div
{
margin: 0;
padding: 0;
}
#navBar
{
border: 1px solid black;
margin-left: auto;
margin-right: auto;
margin-top: 10px;
width: 50%;
}
.navBtn
{
border: 1px solid black;
display: inline-block;
text-align: center;
}
</style>
</head>
<body>
<div id="navBar">
<div class="navBtn" style="width:20%">Text</div><div class="navBtn" style="width:20%">Text</div><div class="navBtn" style="width:20%">Text</div><div class="navBtn" style="width:20%">Text</div><div class="navBtn" style="width:20%">Text</div>
</div>
</body>
</html>
, : 5 div , , . divs php, .