HTMLTextAreaElement: cols プロパティ - Web API | MDN

Baseline Widely available

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

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

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

js

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

仕様書

Specification
HTML
# dom-textarea-cols

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.