cols (HTML attribute)

Spec
Depr. Version
No HTML 4.01
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

cols="Comma-seperated list of column width definitations"

Description

Without a cols or rows attribute, the browser will not know what layout the author intended. If a frameset comprising 3 windows, laid out in column formation is required (as detailed in the the example HTML), the cols attribute is used, along with the values of the respective window widths.

Example

A frameset comprising 3 columns of windows:

<frameset cols="200,*,100">
  <frame src="frame1.html"/>
  <frame src="frame2.html"/>
  <frame src="frame3.html"/>
</frameset>

Value

Each frame’s width is set in the parent frameset in the cols attribute in a comma-separated list. Acceptable values are integers (which represents a width in pixels - do not need to specify that it’s pixels, this is assumed), percentages and a "*" character, which represents the remaining space required (whatever that value may equate to). Each of the examples below show valid values for the frameset:

<frameset cols="80,*,80">
windows 1 and 3 are 80 pixels wide, window 2 is flexible

<frameset cols="33%,33%,33%">
Each window is set to take up 33% of the viewport's width

<frameset cols="40%,*,100">
window 1 takes up 40% of the viewport's width, window 3 takes up 100 pixels,
while window 2 is flexible, taking up whatever is the remaining space

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

Every browser listed supports this attribute.

User-contributed notes

There are no comments yet.

Related Products