当前位置: 动力学知识库 > 问答 > 编程问答 >

html - Expand to fit in an overflowed container

问题描述:

I have several divs in a container div with overflow set to auto. I need to expand the width of all divs to fit the overflowed width of the container.

Here is a very simple example:

http://jsfiddle.net/DDtuM/2/

网友答案:

I'm not sure whether this is possible purely using HTML and CSS, but I wrote jquery to do this.

It simply finds the max width of all the inner divs and then sets the value of all inner divs to max.

Find the code here: http://jsfiddle.net/DDtuM/5/

网友答案:

try adding display: table; to #container

see: http://jsfiddle.net/DDtuM/13/

Drawback: older versions of IE do not support display: table.

分享给朋友:
您可能感兴趣的文章:
随机阅读: