开发者

Overlapping Divs -- How to Wrap Around?

I got a large div that is containing several dynamic divs inside of it.

They are often padded to the left and inside another div that is also padded left.

What I'm trying to do is have the overall containing div (it has a border) look inside these children divs and find how big it needs to expand itself in order to look like it's "containing" all its children.

Any ideas on a nice elegant way to do this? Right now I've got some hobbled together combination of finding the large div in question, finding its leng开发者_如何学Cth and adding on all the -left-padding of its parents.


just set the css property, overflow:hidden; on your "overall containing div". That'll make it automatically expand to contain all the stuff inside it.


You could use a CSS clearfix. This is ideal for floating the contents inside a container. Just save the code to clearfix.css and link to that in your html.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜