# Content Alignment

By default, Grid cell content is left-aligned.

The alignment methods in this article apply to cells generated from the column definitions. If you use a [`ClientRowTemplate()`](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/data-management/grid/templates/row-templates), the template defines the `<tr>` and `<td>` markup, so apply the alignment class or style directly to the relevant `<td>` elements in the template.

## Cell Content

To change the content alignment of the Grid, use either of the following approaches:

* Apply a `text-align` style to the column definition by using the `HtmlAttributes()` method.

  ```Razor HtmlHelper
      .Columns(columns =>
      {
          columns.Bound(o => o.OrderID).HtmlAttributes(new { style = "text-align: right" });
      })
  ```

  ```Razor TagHelper
  <column field="OrderID" html-attributes='new Dictionary<string,object> { ["style"] = "text-align: right" }'/>
  ```

* Apply the `k-text-left`, `k-text-right`, or `k-text-center` classes to the column definition by using the `HtmlAttributes()` method.

  ```Razor HtmlHelper
      .Columns(columns =>
      {
          columns.Bound(o => o.OrderID).HtmlAttributes(new { @class = "k-text-right" });
      })
  ```

  ```Razor TagHelper
  <column field="OrderID" html-attributes='new Dictionary<string,object> { ["class"] = "k-text-right" }'/>
  ```

## Column Headers

Set the alignment of the column headers through the `HeaderHtmlAttributes()` method.

```Razor HtmlHelper
    .Columns(columns =>
        {
            columns.Bound(o => o.OrderID).HeaderHtmlAttributes(new { style = "text-align: right; justify-content: flex-end;" });
        })
```

```Razor TagHelper
<column field="OrderID" header-html-attributes='new Dictionary<string,object> { ["style"] = "text-align: right; justify-content: flex-end;" }'/>
```

## Column Footers

When a column has a footer, change the alignment of its content by using the `FooterHtmlAttributes()` method.

```Razor HtmlHelper
    .Columns(columns =>
        {
            columns.Bound(o => o.OrderID).FooterHtmlAttributes(new { style = "text-align: center" });
        })
```

```Razor TagHelper
    <column field="OrderID" footer-html-attributes='new Dictionary<string,object> { ["style"] = "text-align: center" }'/>
```

## See Also

* [ASP.NET Core Grid overview](https://www.telerik.com/aspnet-core-ui/grid)

* [Content Alignment of the Grid HtmlHelper for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/grid/cell-alignment)

* [Grid server-side API reference for ASP.NET Core](https://www.telerik.com/aspnet-core-ui/documentation/api/grid)
