http://jsfiddle.net/rs659rLh/5/
How to keep the .label
tag width auto fit the content inside (make span next to input)
I think problem is the wrapper .dropdown-list
set position absolute but I need that? I tried set the .dropdown-list
position top bottom left right zero but still not work and these not work too...
according https://stackoverflow.com/a/7337237/1575921 seems the only way is set the position:absolute;
wrapper specific width (auto or 100% both not work)
/* config */
ul {
list-style: none;
}
ul, li {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
word-wrap: break-word;
}
.relative {
position: relative;
}
.absolute {
position: absolute;
}
.clearfix >div, .clearfix >li, .clearfix >span, .clearfix >ul, .clearfix >input {
float: left;
}
.clearfix:after {
content: '';
display: block;
clear: both;
visibility: hidden;
height: 0;
}
input, span {
display: block;
}
/* end: config */
.dropdown-list {
background-color: yellow;
}
<ul class="clearfix">
<li>
<div class="clearfix">
<ul>
<li>top</li>
</ul>
<span>icon</span>
</div>
<div class="container relative">
<ul class="dropdown-list absolute">
<li>
<div class="label clearfix">
<input type="checkbox" value="{{name}}">
<span>{{name................}}</span>
</div>
</li>
</ul>
</div>
</li>
</ul>