Home  >  Article  >  Web Front-end  >  Ask: div double column layout problem_html/css_WEB-ITnose

Ask: div double column layout problem_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:07:321290browse

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>


Reply to discussion (solution)

.div3{		border: 1px solid red;	margin-left:102px;	height:200px;}

width:100%; remove

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn