Textarea cols property when using CSS

It seems that in order to comply with XHTML requirements, the HTML text field should have the cols property. I want to use CSS instead, so I can just expand the text box to 100%style="width: 100%;"

How should I do this in a standard way?

+3
source share
3 answers

I usually set a reasonable amount of columns and rows, for example 60 and 5. If you specify the width using CSS, then the cols and rows attributes will not have any function.

+4
source

Use both options. Thus, if CSS is disabled or not implemented in the target browser, it still works.

+3
source

css, , rows.

<textarea type="text" rows="3" style="resize:none; " class="form-control" name="body"  required id="body" > hello</textarea>

now rowshas "1" - "5", and the integer value will be really great.

-1
source

Source: https://habr.com/ru/post/1718411/


All Articles