I have such html and css.
<div class="selected">
<div class="text">First</div>
<div class="arrow"> </div>
</div>
.selected { width: 150px; }
.selected .text { background: url(dropdown_text.png); float: left; }
.selected .arrow { background: url(dropdown_arrow.png); width:22px; float: right; }
I need to put in ".text" a width that is 150px - 22px. Fill all empty between two floats. I made it with jQuery, but I think its not the right way.
$('.selected .text').each(function(i, n) {
var ctrlwidth = $(n).parents('.selected').width();
var arrowidth = $(n).parent().find('.arrow').width();
$(n).width(ctrlwidth - arrowidth);
});