开发者

What's the point of using the "cols" attribute of the <textarea> tag in HTML?

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


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


It determines how wide to render the element.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜