I'm trying to find a pure CSS way to have 1 or more elements inline and have them adjust their width to fill the container e.g.
1 element
[------]
2 elements
[---***]
3 elements
[--**..]
Is this achievable through pure CSS?
I'm trying to find a pure CSS way to have 1 or more elements inline and have them adjust their width to fill the container e.g.
1 element
[------]
2 elements
[---***]
3 elements
[--**..]
Is this achievable through pure CSS?
use display: table on parent, and display: table-cell on children. then you can add as many inner div's as you wish. Like this:
HTML
<div class="container">
<div class="inner">1</div>
<div class="inner">2</div>
<div class="inner">3</div>
</div>
CSS:
.container {
display: table;
width: 500px;
height: 300px;
outline: 1px solid red;
}
.inner {
display: table-cell;
outline: 1px solid blue;
}
here's fiddle: http://jsfiddle.net/w8p2nj9z/