html - Span not growing with child size -
i trying put 2 components on same line , have wrapped this. trying keep reusable possible , trying general of solution possible.
html:
<div class="form-group"> <span class="component-parent"> <label for="driverslicense.num">driver's license #</label> <input type="text" class="form-control" id="driverslicense.num"></input> </span> <span class="component-parent"> <label for="driverslicense.state">state</label> <select id="driverslicense.state" class="form-control"></select> </span> </div>
css:
label { display: block; } .component-parent { display: inline-block; } .form-control { width: 100%; padding: 6px 12px; }
the width: 100% inherited bootstrap , if remove it cause kinds of problems rest of layout.
the problem input
underneath select
, them have little bit of space in between them. if remove width: 100%
looks correct , if remove padding 2 components touch no space in between them insertion point in wrong place.
here fiddle showing phenomena.
is there way change css of form-group
solve problem? can add additional container(s) if need rather not change css or html of either of component-parent
elements or children.
it issue padding applying select! added
box-sizing:border-box;
which solved problem, need float spans clear gap!
let me know if have question! :) best!
Comments
Post a Comment