开发者

Is there a way to make a div's height depend on one sub div's content but not another?

开发者 https://www.devze.com 2023-03-29 11:46 出处:网络
If I have a div with two sub div\'s within: is it possible to have height:auto; on the parent element but only apply it to one child element, and have the other set to overflow-y:scroll;?

If I have a div with two sub div's within: is it possible to have height:auto; on the parent element but only apply it to one child element, and have the other set to overflow-y:scroll;?

Here is an examlpe: http://jsbin.com/equpor/2/edit

This is what I mean: can I make div.one adept it's height to div.two but ignore div.three?

Is there any proper way to solve this? Thank you!

Edit: The content in div.three is generated by a php foreach loop from an xml file, so I want to be able to edit the xml without editing the html/css every time. So I don't know how long div.three will be. I want 开发者_StackOverflow社区it to be dynamic.


Yes you can. All you have to do is set a fixed height for div 3.

see example

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号