Home HTML Attributes valign HTML valign Attribute Definition
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.
Syntax
HTML Syntax <td|th valign=" top | middle | bottom | baseline ">
Modern equivalent: td { vertical-align: middle; } (same keywords: top, middle, bottom, baseline).
Values
Attribute Values Enumerated values and CSS replacements:
Value Description Try it topContent at the top of the cell. Prefer vertical-align: top Try itmiddleVertically centered. Prefer vertical-align: middle Try itbottomContent at the bottom. Prefer vertical-align: bottom Try itbaselineAlign text baselines across cells. Prefer vertical-align: baseline Try itCSS only Recommended form for new tables Try it
Try it
Live Preview Toggle deprecated valign on the tall sample cell. Prefer CSS in real projects.
Code
HTML Examples Legacy snippets for study, plus the CSS replacement. Use Try It Yourself for a live editor.
1. Cell valign (legacy) 2. Compare values 3. CSS replacement Example 1 — Cell valign (Legacy) How old tables pinned content to the top of a tall cell.
<!-- 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> Deprecated attributes for recognition — prefer CSS in new work.
How It Works Tall cells make vertical alignment visible (height here is also legacy).valign on each td places that cell’s content.Browsers still paint it for old documents.Action — migrate to vertical-align when you edit the page.Example 2 — Header + Body Cells Headers and data cells could each set vertical alignment.
<!-- 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> Label Short note at the top of a tall cell.
How It Works th and td both accepted valign.Different cells, different values — bottom header vs top body text.baseline is useful when aligning first lines of text across cells.Prefer classes + CSS so alignment is shared and themeable.Example 3 — CSS vertical-align (Recommended) Same effect without presentational HTML attributes.
<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> CSS vertical-align — the recommended approach.
How It Works Keep HTML semantic — no valign attributes.Set vertical-align on td/th (or a class).CSS wins if both attribute and property are present.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 tooThe 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.
Compatibility
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.
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.
Remember
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 What does the HTML valign attribute do? It sets vertical alignment of content in a table cell or row group. Classic values are top, middle, bottom, and baseline.
Is valign deprecated? Yes. MDN and the HTML standard treat it as deprecated / obsolete presentational markup. Use the CSS vertical-align property instead.
Which elements used valign? Historically td, th, tr, thead, tbody, tfoot, col, and colgroup. Learn it to read legacy tables; do not add it to new pages.
What replaces valign="middle"? Use CSS vertical-align: middle on the cell (or a shared class on td/th).
How is valign different from align? valign is vertical (top/middle/bottom). align is horizontal (left/center/right/justify). Both are deprecated in favor of CSS.
Will browsers still honor valign? Most still paint it for old pages, but CSS vertical-align takes precedence when both are set. Prefer CSS only in new work.
About the author Developer, cloud engineer, and technical writer
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
Helpful Share Copy link Suggestion