Tutorial :What's the point of using the “cols” attribute of the <textarea> tag in HTML?



Question:

The "cols" attribute is required in valid HTML but I don't see the benefit of using it. Do you?


Solution:1

If the client does not support CSS, it will still be able to see <textarea> with right width.


Solution:2

It determines how wide to render the element.


Solution:3

When browsers and html parsing software looks at HTML it will be looking for a set of mandatory attributes on a tag. Such as every <img> tag needs an alt="" attribute.

So when running your site through a HTML validator you need to make sure the mandatory attributes are in place else validation will fail..

Secondly when a user is using assistive technologies, they tend to turn off CSS/Javascript altogether so making sure you have cols="" in there is important. Screan readers and such may not be able to parse your webpage properly if it can't find required attributes for your markup.

Conclusion: Theres a bigger picture than just tweaking some stylesheet info. Make sure you conform to spec. If you want to style things pretty make sure you have sensible fallback for non-css webpages.


Solution:4

Check out this link.. Might help you -

http://www.highdots.com/forums/cascading-style-sheets/textarea-cols-width-261859.html

also this one -

http://www.highdots.com/forums/html/purpose-cols-rows-textarea-275801.html


Solution:5

"cols" using for increase the width of textarea` in html.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »