詳細: 2 つの div があり、 one float:left
、 other float:right
、および parent はclear:both
、ページ上でコンテナーの親を下に並べることができるようにするためです。具体的な CSS は次のとおりです。
#content {
margin-left:auto;
margin-right:auto;
width: 750px;
margin-top:50px;
position:relative;
}
.container-div {
padding-top:7px;
padding-bottom:10px;
clear:both;
background-color:#b0c4de;
}
.left-side {
float:left;
}
.right-side
float:right;
}
問題はbackground-color
、親の がコンテナーの上部のごく一部しかカバーしていないことです。クロム インスペクターは、コンテンツが明らかにその部分のみであることを示しています。何を与える?フロートされた div をコンテンツとして div に表示させるにはどうすればよいですか?