td/th chOffProperty

td/th 对象参考手册td/th Object

Definition and Usage

The chOff property sets or returns the offset of the alignment character of a cell.

Syntax

Set the chOff property:

tdObject.chOff="px|%"

or

thObject.chOff="px|%"

Return the chOff property:

tdObject.chOff

or

thObject.chOff

Tip:The chOff property has no default value.

Value Description
px Defines the horizontal offset, in pixels
% Defines the horizontal offset using a percentage


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the chOff property, however, no mainstream browser implements the functionality of this property.


Example

Example

The "Savings" column is aligned two characters from the right side of ".":

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial(example.com)</title>
<script>
function displayResult(){
    var c=document.getElementById("myCol");
alert("The horizontal offset of the ch attribute is: " + c.chOff);
}
</script>
</head>
<body>

<table border="1">
    <colgroup>
        <col>
        <col id="myCol" align="char" char="." charoff="2">
    </colgroup>
    <tr>
<th>Month</th>
<th>Savings</th>
    </tr>
    <tr>
        <td>January</td>
        <td>$100.00</td>
    </tr>
    <tr>
        <td>February</td>
        <td>$10.00</td>
    </tr>
</table>
<br>
<button type="button" onclick="displayResult()">Horizontal offset of character alignment</button>
<p><b>Note:</b> Not all major browsers support the functionality of the choff attribute.</p>

</body>
</html>

Try it yourself »


td/th 对象参考手册td/th Object Other Extensions