css - Oneline horizontal list with middle item that fits its content width -


i have horizontal list of items, arranged display:table-cell.

the middle item can vary in content length, , should expand accordingly. , siblings should shrink make space it.

here sample of did until now:

http://codepen.io/pictor13/pen/mjoyxw

but middle item still overflows on right sibling, when content grows.

is possible achieve want? display: table-cell , white-space: nowrap right approach?

note: width, if specified, should generic , not fixed specific px/em.

wellll....flexbox can that.

.container {    background-color: yellow;    padding: 1px;  }  li {    text-align: center;    border: 2px solid #ccc;    background-color: green;    color: red;    list-style: none;  }  ul {    display: -webkit-box;    display: -webkit-flex;    display: -ms-flexbox;    display: flex;    padding: 0;    margin: 3px;    background-color: brown;  }  li {    -webkit-box-flex: 1;    -webkit-flex: 1 0 auto;    -ms-flex: 1 0 auto;    flex: 1 0 auto;  }  input {    width: 270px;    width: inherit;  }  form {    background-color: blue;    margin: 0;    padding: 0;  }
<div class="container">    <ul class="list">      <li>b</li>      <li>c</li>      <li class="middle">        <form>          <input type="number" value="123123418190238901390812903823" min="1" max="123012301232138192738798127398712983" />          <span>to page , long  content</span>          <button>go</button>        </form>        </li>      <li>e</li>      <li>a</li>    </ul>  </div>

codepen demo


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -