码迷,mamicode.com
首页 > 其他好文 > 详细

有没有人可以解决这个问题?

时间:2016-12-05 19:20:18      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:doctype   back   margin   round   pre   log   style   tle   div   

只用html和css如何使左边的div(menu)的高度与右边的div(wrap)一样高。

<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Du~</title>
  <style>
  #wrap
  {
  margin:0;
  height:1500px;
  width:1500px;
  background:#666;
  position:absolute;
  }
  }
  #_height
  {
  margin:0;
  height:100%;
  }
  #menu
  {
  margin:0;
  height:100%;
  width:200px;
  background:#ccc;
  }
  </style>
 </head>
 <body>
  <div id="_height">
	  <div id="wrap"></div>
	  <div id="menu"></div>
  </div>
 </body>
</html>

  上面用的思想是把父元素的height设置成100%其子元素的height也设为100%,两个div高度会相等。然鹅这种方法并不能成功,绵山你有没有什么方法可以让左边的menu的高度与右边的wrap相等呢?

有没有人可以解决这个问题?

标签:doctype   back   margin   round   pre   log   style   tle   div   

原文地址:http://www.cnblogs.com/GUOZHENY/p/6134861.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!