`
qq351943923
  • 浏览: 9392 次
社区版块
存档分类
最新评论

div里面包含3个按比例分割的div

    博客分类:
  • html
 
阅读更多

只是收集几种方式供选用!

子div没有float

 

子div一定要指定高度!否则会无效

(指定高度 float:左右都行)

但是假如没有指定父元素div的的高度 那么父元素也要float 这样才能跟着子元素最高元素有相同的高度

<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>

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics