HTML valign Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The valign attribute sets vertical alignment of content in a table cell (or related table parts). Classic values are top, middle, bottom, and baseline.

It appeared on <td>, <th>, <tr>, <thead>, <tbody>, <tfoot>, and <col> / colgroup. For new work, use CSS vertical-align. Related obsolete attribute: align (horizontal).

Deprecated / obsolete.

Do not use valign in new pages. Prefer vertical-align in CSS. Browsers still support it for old tables — learn it to read legacy HTML, not to ship it.

HTML Syntax

syntax.html
<td|th valign=" top | middle | bottom | baseline">

Modern equivalent: td { vertical-align: middle; } (same keywords: top, middle, bottom, baseline).

Attribute Values

Enumerated values and CSS replacements:

ValueDescriptionTry it
topContent at the top of the cell. Prefer vertical-align: topTry it
middleVertically centered. Prefer vertical-align: middleTry it
bottomContent at the bottom. Prefer vertical-align: bottomTry it
baselineAlign text baselines across cells. Prefer vertical-align: baselineTry it
CSS onlyRecommended form for new tablesTry it

Live Preview

Toggle deprecated valign on the tall sample cell. Prefer CSS in real projects.

valign

Legacy demo only. New pages should use vertical-align instead.

Table cell
Sample textNeighbor
with
more
lines

valign="middle" — prefer vertical-align: middle

HTML Examples

Legacy snippets for study, plus the CSS replacement. Use Try It Yourself for a live editor.

Example 1 — Cell valign (Legacy)

How old tables pinned content to the top of a tall cell.

HTML
<!-- Deprecated — for study only -->
<table border="1" cellpadding="8">
  <tr>
    <td valign="top" height="100">Top</td>
    <td valign="middle" height="100">Middle</td>
    <td valign="bottom" height="100">Bottom</td>
  </tr>
</table>
Try It Yourself

How It Works

  1. Tall cells make vertical alignment visible (height here is also legacy).
  2. valign on each td places that cell’s content.
  3. Browsers still paint it for old documents.
  4. Action — migrate to vertical-align when you edit the page.

Example 2 — Header + Body Cells

Headers and data cells could each set vertical alignment.

HTML
<!-- Deprecated — for study only -->
<table border="1" cellpadding="8">
  <tr>
    <th valign="bottom" height="80">Label</th>
    <td valign="top" height="80">
      Short note at the top of a tall cell.
    </td>
  </tr>
</table>
Try It Yourself

How It Works

  1. th and td both accepted valign.
  2. Different cells, different values — bottom header vs top body text.
  3. baseline is useful when aligning first lines of text across cells.
  4. Prefer classes + CSS so alignment is shared and themeable.

Example 3 — CSS vertical-align (Recommended)

Same effect without presentational HTML attributes.

HTML
<style>
  table.demo { border-collapse: collapse; }
  table.demo td {
    border: 1px solid #333;
    padding: 8px;
    height: 100px;
  }
  .v-top { vertical-align: top; }
  .v-middle { vertical-align: middle; }
  .v-bottom { vertical-align: bottom; }
</style>

<table class="demo">
  <tr>
    <td class="v-top">Top</td>
    <td class="v-middle">Middle</td>
    <td class="v-bottom">Bottom</td>
  </tr>
</table>
Try It Yourself

How It Works

  1. Keep HTML semantic — no valign attributes.
  2. Set vertical-align on td/th (or a class).
  3. CSS wins if both attribute and property are present.
  4. Study next — vertical-align and tables.

Edge Cases & Pitfalls

Most issues are shipping presentational HTML, or confusing valign with horizontal align.

obsolete

Authors should omit it

Presentational. Separation of concerns: structure in HTML, alignment in CSS.

vs align

Not horizontal alignment

align was left/center/right. valign is top/middle/bottom. Replace with text-align and vertical-align respectively.

CSS

CSS overrides the attribute

If a stylesheet sets vertical-align, that wins over valign on the same cell.

IDL

cell.vAlign is deprecated too

The DOM property mirrors the old attribute. Prefer reading/setting element.style.verticalAlign or classes.

height

Need height to see the effect

In a short cell, top/middle/bottom look the same. Tall rows (or multi-line neighbors) reveal the difference.

Browser Support

valign is a deprecated HTML presentational attribute on table parts. Engines still honor it for legacy pages; authors must not use it in new work.

✓ Deprecated · Do not use

valign

Still rendered for compatibility in major browsers, but obsolete in the HTML Standard. Migrate to CSS vertical-align.

N/A Author use (do not)
Google Chrome Legacy support
Prefer CSS
Mozilla Firefox Legacy support
Prefer CSS
Apple Safari Legacy support
Prefer CSS
Microsoft Edge Legacy support
Prefer CSS
Opera Legacy support
Prefer CSS
Samsung Internet Legacy support
Prefer CSS
Internet Explorer Legacy support
Prefer CSS
valign Legacy only

Bottom line: Safe to recognize in old tables. For new pages, use vertical-align in CSS and leave valign out of the markup.

Key Takeaways

  • Status: deprecated — omit in new HTML.
  • Values: top, middle, bottom, baseline.
  • Replace with: CSS vertical-align on cells.
  • Not align: that was horizontal; both are obsolete presentation.

One line: valign was vertical cell alignment in HTML tables — use vertical-align in CSS instead.

Frequently Asked Questions

It sets vertical alignment of content in a table cell or row group. Classic values are top, middle, bottom, and baseline.
Yes. MDN and the HTML standard treat it as deprecated / obsolete presentational markup. Use the CSS vertical-align property instead.
Historically td, th, tr, thead, tbody, tfoot, col, and colgroup. Learn it to read legacy tables; do not add it to new pages.
Use CSS vertical-align: middle on the cell (or a shared class on td/th).
valign is vertical (top/middle/bottom). align is horizontal (left/center/right/justify). Both are deprecated in favor of CSS.
Most still paint it for old pages, but CSS vertical-align takes precedence when both are set. Prefer CSS only in new work.

Next: value

Set the value of form controls and other elements.

value tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful