The input element by default is size="20" if this is not defined inline or a CSS style rule is attributed to it.
How do you make the default the actual size of the value? For other elements:
<div style="display: inline; width: auto;">
The box will only fit the width of it's content
</div>
width: auto is all you need. I cannot put a defined width since the value may be longer. For example:
<input id="short" type="text" value="1000" />
<input id="long" type="text" value=" Areally long name is in this input field." />
I want #short to be the size of 1000 (essentially size="4" + the padding) but the #long to be as long as needed. These inputs are coming in programatically so I can't simply put a short class on the one's I want short and a long class on the one's I want long. I would really just like it if I could put:
input { width: auto; }
Anyway to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…