I am trying to add a background-color to a div that contains two more divs within it. But the background color doesn't stay all the way under the two divs.
The two divs are inside the div that i added the background to, so I thought the background should end under or beside the two divs.
.characters {
margin: 0;
border: 5px solid black;
float: left;
width: 50%;
box-sizing: border-box;
}
.characters img {
width: 100%;
height: auto;
display: block;
border-bottom: 5px solid black;
}
.infos {
background-color: gray;
padding: 35px;
text-align: center;
}
.infos h2, .infos h3 {
margin: 0;
}
.page {
margin-top: 35px;
padding: 10px;
background-color: lightgray;
}
<div class="page">
<div class="characters">
<img src="pic.jpg" alt="pic" width="100px" height="100px"/>
<div class="infos">
<h2>text</h2>
<h3>text</h3>
</div>
</div>
<div class="characters">
<img src="pic.jpg" alt="pic1" width="100px" height="100px"/>
<div class="infos">
<h2>text</h2>
<h3>text</h3>
</div>
</div>
</div>