CSS Tip - Multiple elements sharing full width

Shameer

15 Aug, 2014

Sometime you may want to have multiple divs inside a container sharing 100% width equally. This is especialy useful when you have dynamic number of divs which should equaly divide full width. This is where display:table comes handy. When you set the display property as table, it behaves like table. Here is an example:

First cell

Second cell

Third cell

If you remove any cell, the other two will expand to fill up the full width. Toggle CellCode: