Say, I have the following unordered list. The button has width: auto
. How do I style the elements, so #textField
would stretch as much as possible, so the width of #textField
and the button would add up to 100%? I.e. #textField
's width == (100% of width) - (button's computed width).
<ul>
<li>
<input id="textField" type="text" /><input type="button" />
</li>
</ul>
So, for example, let's say 100% width of li
is 100 pixels: if the button's computed width is 30px, #textField
's width would be 70px; if button's computed width is 25px, #textField
's width would become 75px.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…