如何强迫孩子Div到100%的父母的Div而不指定父母的身高? [英] How to Force Child Div to 100% of Parent's Div Without Specifying Parent's Height?

查看:121
本文介绍了如何强迫孩子Div到100%的父母的Div而不指定父母的身高?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这是可能的,但我只是无法想象它。

I would assume this is possible, but I just cant figure it out..

我有一个网站的基本结构设置如下。

I have a site thats basic structure is set up as follows.

<div id="header"></div>

<div id="main">
  <div id="navigation"></div>
  <div id="content"></div>
</div>

<div id="footer"></div>

导航是左侧导航,其右侧有一个内容div。我想垂直缩放导航与内容div相同的高度取决于什么被加载到内容div。内容div的信息通过PHP被拉入,所以每次都是不同的。反正长故事短。有没有办法设置它,使我的导航永远是内容div的整个高度,无论加载哪个页面?

The navigation is a left hand navigation with a content div to the right of it. I would like to scale the navigation vertically to be the same height as the content div depending on what is loaded into the content div. the information for the content div is pulled in through PHP, so it is different every time. anyway long story short. Is there a way to set it so that my navigation will always be the full height of the content div no matter which page is loaded?

推荐答案

我建议您查看等高列有跨浏览器CSS和没有黑客

基本上,使用CSS在浏览器兼容的方式是这样做不是微不足道(但微不足道的表),所以找到一个适当的预打包解决方案。

Basically, doing this with CSS in a browser compatible way is not trivial (but trivial with tables) so find yourself an appropriate pre-packaged solution.

此外,答案取决于你是否想要100%的高度或相等的高度。通常它的高度相等。如果是100%的高度,答案稍有不同。

Also, the answer varies on whether you want 100% height or equal height. Usually it's equal height. If it's 100% height the answer is slightly different.

这篇关于如何强迫孩子Div到100%的父母的Div而不指定父母的身高?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆