父div的高度不增长
我无法让父级 div 随着子级的成长而延长其高度(弗洛伊德?:-))
这里的父级是“main_bottom”,其中包含“main_mid”及其子级。
该结构有点不寻常,因为文本必须位于圆角内,圆角很大,因此我无法使用通常的“固定顶部 - 然后动态中间 - 然后固定底部”例程。
当然,可怕的粉色和红色只是为了让孩子们的 div 尺寸很容易看到。
任何帮助将不胜感激,祝你
有美好的一天
I'm having trouble getting a parent div to extend its height as its children grow (Freud? :-))
the parent here being "main_bottom" which contains "main_mid" and its children.
the structure is a little unusual because the text has to be within the rounded corners, which are large, so i could not use the usual 'fixed top - then dynamic mid -then fixed bottom' routine.
of course the horrible pink and red are only so that the children divs dimensions are easy to see..
any help will be highly appreciated
have a nice day
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我几次遇到这些问题。我的解决方案是添加 display:block;在子div和高度中:自动;在父分区中。
I met these problems couple time. My solution is that adding display:block; in child div and height:auto; in parent div.
文本的父容器之一具有固定高度,并且文本浮动但不清除。从
#main_bottom
中删除height: 135px
(或许替换为min-height
)规则,并添加overflow: auto
> 规则到#main_mid
来清除浮动,布局将按预期工作。One of the parent containers for the text has a fixed height, and the text is floated but not cleared. Remove the
height: 135px
(perhaps replace withmin-height
) rule from#main_bottom
and add anoverflow: auto
rule to#main_mid
to clear the float and the layout will work as intended.使用
overflow: auto
和height: auto
添加这些定义,容器将适合内部内容。
add these definitions
with
overflow: auto
andheight: auto
the container will fit to the content inside.