I've got a situation, where i have a few divs with absolute position (for 3d flipping effect ). As a result, parent div's height is very small and absolute content overflows on top of lower content. Can't really set a fixed height for responsive reasons.

我有一种情况,我有几个具有绝对位置的div(用于3D翻转效果)。因此,父div的高度非常小,绝对内容在较低内容之上溢出。由于反应原因,无法真正设置固定高度。

I'm planning to give children divs relative position, and then gather height with a help of jquery and set the height based on it. But there really is a lot of elements and vars for responsive. Is there any other, more elegant way to make children fit the parent?

我打算给孩子div相对位置,然后在jquery的帮助下收集高度并根据它设置高度。但是真的有很多元素和vars用于响应。有没有其他更优雅的方式让孩子适合父母?

http://jsfiddle.net/xyjrLa2p/

html

<div class="parent">
<div class="title">Title</div>
<div class="absolute">
    <p>Absolute</p>
    <p>Absolute</p>
    <p>Absolute</p>
</div>
<div class="clearboth"></div>
</div>

css

.parent {
position:relative;
background-color:yellow;
}
.absolute {
position:absolute;
}
.absolute p {
padding:5px;
}
.clearboth {
clear:both;
}

2 个解决方案

#1


0

If you don't mind .absolute posistion, try to make it relative:

如果你不介意.absolute posistion,试着让它相对:

.absolute {
    position:relative;
}

Working example -- http://jsfiddle.net/xyjrLa2p/3/

工作示例 - http://jsfiddle.net/xyjrLa2p/3/

更多相关文章

  1. 保持子div的宽高比与父级的高度和宽度变化
  2. 浮动到页面底部的可变高度页脚的CSS(不是视口)
  3. 100%高度分区内显示:表格单元分区
  4. JQuery基于元素的高度添加类
  5. IFrame中的Div没有达到给定的高度
  6. Chrome 50更改隐式表格单元格高度行为
  7. 两个堆叠DIV的顶部DIV如何影响另一个DIV的高度
  8. CSS:浮动时忽略div高度
  9. DiggBar如何基于不在其域上的内容动态调整其iframe的高度?

随机推荐

  1. 7种形式的Android Dialog使用举例
  2. 三星揭幕之际,苹果高管再次炮轰Android和
  3. eBook 功能模块二之设置模块Android
  4. [置顶] Android(安卓)从硬件到应用:一步一
  5. Android性能测试
  6. Android随想
  7. Android面经:二流Android攻城狮用一个月面
  8. 丢失Android系统库或者Conversion to Dal
  9. android 如何监听自身应用被卸载
  10. 【Android 1.6】View和ViewGroup的touch