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
ἔρως
ἔρως5d ago
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
bfmv
bfmvOP5d ago
ohk why should we not change the height
ἔρως
ἔρως5d ago
because then it looks like a textarea, and confuses people
Jochem
Jochem5d ago
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"
ἔρως
ἔρως5d ago
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
Jochem
Jochem5d ago
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
ἔρως
ἔρως5d ago
yup and make sure it doesnt look 2 lines tall that's where the confusion starts
bfmv
bfmvOP5d ago
ohh i get it now

Did you find this page helpful?