textarea/input
how do i give width and height to textarea/input?
should i use cols and rows attributes
should i use css to give them width and height
or is any fine
is there any better option
8 Replies
that is a deep can of worms
you can use the cols and rows (i would even say "should" so it isnt some wacky size before the css loads)
for inputs, they usually have 300px by default
you can change the width of both to 100% and let the parent deal with the size
you can set a maximum width as well
you can set a fixed width and deal with the sizes by using media queries
just dont change the height of an input
ohk
why should we not change the height
because then it looks like a textarea, and confuses people
he's saying "don't make it 5 lines tall" not "you can't add padding and have to stick with the 1.something lh default height no matter what"
yup
that is what i meant
if you make it tall, people will think it is a textarea and will try to add new lines, but accidentally submit the form
it's easier if you just let the height be what it is by default, and add your padding if needed
rather: make it look like it's vaguely the right size for a single line of text at whatever font size is set for the input
yup
and make sure it doesnt look 2 lines tall
that's where the confusion starts
ohh
i get it now