w3resource

HTML char attribute

char

The purpose of the HTML char attribute is to define the axis of alignment for a block of text.

Supported elements

HTML char attribute supports col, colgroup, tbody, td, tfoot, th, thead, tr element.

Syntax

<element align="char" char="." />

Where ElementName is any supported element.

Type of value

Type of value of HTML char attribute is a character.

Value

A character (like '.', ',').

Default value

The default value for this attribute is the decimal point character for the current language as set by the lang attribute (e.g., the period (".") in English and the comma (",") in French).

Supported doctypes

HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.

Example of HTML char attribute with col, colgroup, tbody, td, tfoot, th, thead, tr

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML char attribute with col, colgroup, tbody, td, tfoot, th, thead, tr</title>
</head>
<body>
<table width="200" border="1">
  <col align="left"/>
  <col align="char" char="." />
  <tr>
    <th>Employee Code </th>
    <th>Salary</th>
  </tr>
  <tr>
    <td>EM001</td>
    <td>$12160.00</td>
  </tr>
  <tr>
    <td>Em002</td>
    <td>$12450.00</td>
  </tr>
</table>
</body>
</html>

Result

html char attribute with col colgroup tbody td tfoot th thead tr

View this example in a separate browser window

Example of HTML char attribute with col, colgroup, tbody, td, tfoot, th, thead, tr.

Previous: HTML cellspacing attribute
Next: HTML charoff attribute