HTMLTextAreaElement: cols プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

colsHTMLTextAreaElement インターフェイスのプロパティで、複数行テキストコントロールの見える幅を、平均的な文字幅における文字数で表す正の整数です。これは <textarea> 要素の cols 属性を反映します。

正の整数です。既定値は 20 です。

js
const textareaElement = document.getElementById("comment");
textArea.cols = 80;

仕様書

Specification
HTML
# dom-textarea-cols

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
cols

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報