Gets or sets
where the caption
of a table is located.
Syntax
| CSS |
{ caption-side : sLocation }
|
|---|
| Scripting | [ sLocation = ] object.style.captionSide [ = sLocation ] |
|---|
Possible Values
| sLocation | String that
specifies or receives
the placement of the caption.
top- For horizontal tables (in horizontal writing modes), the caption is placed above the table. Not supported for vertical tables (in vertical writing modes).
bottom- For horizontal tables, the caption is placed below the table. Not supported for vertical tables.
left- For vertical tables, the caption is placed at the left of the table. Not supported for horizontal tables.
right- For vertical tables, the caption is placed at the right of the table. Not supported for horizontal tables.
|
The property is read/write
for all objects except the following, for which it is read-only:
currentStyle.
The property has no default value. The Cascading Style Sheets (CSS) attribute is
inherited.
Remarks
The supported possible values for
caption-side depend on the orientation of the table. Horizontal tables (
-ms-writing-mode set to
lr-* or
rl-*) support the
top and
bottom values. Vertical tables (
-ms-writing-mode set to
tb-* or
bt-*) support the
left and
right values.
Using an unsupported value for this property (for instance,
left on a caption for a horizontal table) will cause the caption to appear at the "logical top" of the table. The logical top of a table depends on the writing mode of the text, and is parallel to and immediately precedes the first line of text in a table.
Captions placed to the left or right of the table are not rotated so as to be read vertically. To do this, use the
Rotation property of the
BasicImage filter (
Windows Internet Explorer only).
This style attribute can be applied to any element with a
display
style of
table-caption.
This property requires
Internet Explorer to be in
IE8 Standards mode rendering.
Examples
The following example constructs a table with standard HTML elements.
The style rule places the caption above the table.
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<style type="text/css">
caption {
caption-side:top;
}
</style>
<table><tr><td>A simple table.</td></tr>
<caption>Table caption.</caption>
</table>
This example uses CSS to construct a table using
display
attributes. This caption is also placed above its associated table.
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<style type="text/css">
.table {
display:table;
border:1px #eee outset;
border-spacing:2px;
}
.cell {
display:table-cell;
border:1px solid black;
}
.caption {
display:table-caption;
caption-side:top;
}
</style>
<div class="table">
<span class="cell">Table content.</span>
<em class="caption">A caption.</em>
</div>
Standards Information
This property is defined in
Cascading Style Sheets (CSS), Level 2 Revision 1 (CSS2.1).
Applies To
See Also
display