cols attribute | cols property

Sets or retrieves the number of columns in the table.


HTML<element cols="nColumns" ... >

nColumns = object.cols


Property values

Type: Integer

the number of columns.

Standards information


Specifying this number can speed up the processing of the table.

Windows Internet Explorer 8 will only render tables up to 1000 columns. To force Windows Internet Explorer 7 rendering mode, see How Do I Take Advantage of the New Features in Internet Explorer 8.


This example uses the cols attribute and the cols property to set the number of columns in HTML and retrieve the number of columns in script.

Code example:

<script type="text/javascript">
function checkCols(oObject)
    var iColumns = oObject.cols;
    alert (iColumns);
<table id=oTable border cols="3" onclick="checkCols(this)">
<tr><td>Column 1</td><td>Column 2</td><td>Column 3</td></tr>

See also