W3Schools.com

td/th chOff Property

td/th Object Reference td/th Object

Definition and Usage

The chOff property sets or returns the horizontal offset of the ch property.

The chOff property sets the number of characters the content will be aligned from the character specified by the char attribute/ch property.

Syntax

Set the chOff property:

tdObject.chOff="px|%"

or

thObject.chOff="px|%"

Return the chOff property:

tdObject.chOff

or

thObject.chOff

Tip: There is no default value for the chOff property.

Value Description
px Defines the horizontal offset in pixels
% Defines the horizontal offset in % of the width of the object


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The chOff property is supported in all major browsers. However, the functionality of this property is not implemented in any of the major browsers.


Example

Example

Align the "Savings" column two characters to the right from the "." character:

<html>
<head>
<script type="text/javascript">
function displayResult()
{
var c=document.getElementById("myCol");
alert("The horizontal offset of the ch property 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>

<button type="button" onclick="displayResult()">Get horizontal offset of the alignment character</button>

</body>
</html> 

Try it yourself »


td/th Object Reference td/th Object
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE