我正在尝试将背景颜色应用于其中有两个浮动 div 的 div,但它没有应用它。容器内的两个 div 都被清除并像我希望的那样彼此并排显示,但整体背景颜色不适用
<div class="contactformcontainer">
<div class="maincontactform">
<h4>SEND US A MAIL</h4>
<form>
<input type="text" placeholder="What is your name ?">
<input type="text" placeholder="Email">
<textarea type="text" placeholder="What is your message to us ?"></textarea>
<input type="submit" value="submit">
</form>
</div>
<div class="maincontactdetails">
<h4>Email : </h4><p>office@blah.org</p>
<h4>Tel : </h4><p>(434)-5564-63443534</p>
<h4>Address : </h4><p>blah blah blah.</p>
</div>
</div>
CSS
.contactformcontainer{
width:100%;
background-color: green;
}
.maincontactform{
width: 47%;
padding: 24px;
float:left;
background-color: blue;
clear:both;
}
.maincontactdetails{
width: 40%;
padding: 24px;
background-color: red;
float:right;
}