tr chOffProperty

tr 对象参考手册tr Object

Definition and Usage

The chOff property sets or returns the offset of the alignment character for cells in a row.

The chOff property can set the number of content characters through the attribute/ch attribute characters.

Syntax

Set the chOff property:

trObject.chOff="px|%"

Return the chOff property:

trObject.chOff

Tip:The chOff property has no default value.

Value Description
px Defines a horizontal pixel offset
% Defines a horizontal offset as a percentage of the object's width.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the chOff property, but none of them implement this functionality.


Example

Example

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

<!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 property.</p>

</body>
</html>

Try it yourself »


tr 对象参考手册tr Object Other Extensions