The div contains 3 proportionally divided divs

Just collect a few ways to choose from!

child div has no float

 

The child div must specify a height! Otherwise it will be invalid

(Specify the height float: either left or right)

But if the height of the parent element div is not specified, the parent element must also float so that it can have the same height as the highest element of the child element.

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>子div</title>

</head>

<body>

<div style="height:130px; border:1px solid red; padding-top:30px;">

  <div style=" float:left; width:33%; background:red; height:100px;"></div>

  <div style=" float:left; width:33%; background:#00ffff; height:100px;"></div>

  <div style=" float:left; width:34%; background:#33CC66; height:100px;"></div>

 </div>

</body>

</html>

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326529995&siteId=291194637