html - Making 2 spans to expand to fit into li width -


i want 2 span expand fit li element.

in original project use bootstrap , jquery too, example enough:

http://jsfiddle.net/d5pc8lp3/

<ol>     <li><span>element-name</span><span>></span></li>     <li><span>i-want-to-fit-like-the-li-width</span><span>></span></li> </ol> 

the first span in li element element name, , second span "navigator".

i want first span width fill rest of li element.

you can use flexbox:

li {   display: flex; /* magic begins */ } li > :first-child {   flex-grow: 1; /* grow fill available space */ } 

ol > li {    list-style-type: none;    padding: 0px;    margin: 0px;    border: 0px;    margin-top: 15px;    display: flex;  }  li > span:nth-child(1) {    margin-right: 3px;    border-bottom-left-radius: 5px;    border-top-left-radius: 5px;    flex-grow: 1;  }  li > span {    padding: 5px;    color: #c7c7c7;    border: 1px #ccc solid;    background: #fff;  }  li > span:nth-child(1) {    margin-right: 3px;    border-bottom-left-radius: 5px;    border-top-left-radius: 5px;  }  li > span:nth-child(2) {    border-bottom-right-radius: 5px;    border-top-right-radius: 5px;  }  li > span:nth-child(1):hover {    border: 1px #1c1c1c solid;    cursor: pointer;  }  li > span:nth-child(2):hover {    border: 1px #1c1c1c solid;    cursor: pointer;  }
<ol>    <li><span>element-name</span><span>&gt;</span></li>    <li><span>i-want-to-fit-like-the-li-width</span><span>&gt;</span></li>    <li><span>my-width-doenst-fit</span><span>&gt;</span></li>  </ol>


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -