Home >Web Front-end >HTML Tutorial >Ask: div double column layout problem_html/css_WEB-ITnose
div double-column layout, outer width: 500px; left column width: 100px, right column width: 100%; margin-left: 150px;
The preview effect is that the actual size of the right column exceeds the outer div.
Please tell me how to ensure that the right column does not exceed the scope of the outer div (it is required not to use js. In actual applications, the outer layer will capture window.resize() to flexibly specify the width).
<!doctype html><html><head><style type="text/css">.div1{ border: 1px solid black; width:500px;}.div2{ width:100px; border: 1px solid blue; float:left; height:200px;}.div3{ width:100%; border: 1px solid red; margin-left:102px; height:200px;}</style></head><body> <div class="div1"> <div class="div2">div2</div> <div class="div3">div3</div> </div></body></html>
.div3{ border: 1px solid red; margin-left:102px; height:200px;}