Expand to fit in a crowded container

I have multiple divs in a div container 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/

+4
source share
2 answers

I'm not sure if this is possible exclusively using HTML and CSS, but I wrote jquery for this.

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

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

+2
source

try adding display: table; in #container

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

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

+1
source

Source: https://habr.com/ru/post/1402348/


All Articles