# Horizontal and Vertical Alignment

## Content

Use the [HorizontalAlignment](/componentone/docs/win/online-truedbgrid/) property of the column's [Style](/componentone/docs/win/online-truedbgrid/) object to control the horizontal placement of cell text within a column. The allowable values for this property are as follows:

* [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**General**
* [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Near**
* [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Center**
* [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Far**
* [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Justify**

The setting [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**General**, which is the default for data cells, indicates that the alignment should be based upon the underlying data type. For example, strings are left-aligned, while numbers are right-aligned.

Use the [VerticalAlignment](/componentone/docs/win/online-truedbgrid/) member of the [Style](/componentone/docs/win/online-truedbgrid/) object to control the vertical placement of text within the cells of a grid, split, or column. The allowable values for this property are as follows:

* [AlignVertEnum](/componentone/docs/win/online-truedbgrid/).**Top**
* [AlignVertEnum](/componentone/docs/win/online-truedbgrid/).**Center**
* [AlignVertEnum](/componentone/docs/win/online-truedbgrid/).**Bottom**

For data cells, the default value is AlignVertEnum.**Top**. For static grid elements such as caption bars, column headers, and column footers, the default value is AlignVertEnum.**Center**. See the [Named Style Defaults](/componentone/docs/win/online-truedbgrid/appearance-styling/built-in-named-styles) topic to learn how the default values are derived.

The following table depicts all possible combinations of the [HorizontalAlignment](/componentone/docs/win/online-truedbgrid/) and [VerticalAlignment](/componentone/docs/win/online-truedbgrid/) properties.

|  | AlignHorzEnum.Near | AlignHorzEnum.Center | AlignHorzEnum.Far |
| --- | ------------------ | -------------------- | ----------------- |
| AlignVertEnum.Top | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-1.png) | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-2.png) | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-3.png) |
| AlignVertEnum.Center | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-4.png) | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-5.png) | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-6.png) |
| AlignVertEnum.Bottom | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-7.png) | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-8.png) | ![](https://cdn.mescius.io/document-site-files/images/a1b176e5-6638-4b1f-a786-e41a817558bb/images/cell-text-9.png) |

The [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**General** and [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Justify** settings have been omitted because the [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**General** setting aligns text as [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Near** and numeric values as [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Far**. The [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Justify** setting aligns text with respect to the cells boundaries, but in this case appears exactly like the [AlignHorzEnum](/componentone/docs/win/online-truedbgrid/).**Near** setting.

The [HorizontalAlignment](/componentone/docs/win/online-truedbgrid/) and [VerticalAlignment](/componentone/docs/win/online-truedbgrid/) properties are tightly integrated with the concept of styles. For more information, see [Styles Collection Editors](/componentone/docs/win/online-truedbgrid/design-time/collection-editors#style-collection-editor).