HTML Guides for align-self
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The validator rejects any align-self value it doesn't know, which catches typos and keywords from other properties, but also the valid anchor-center keyword.
align-self overrides the container's align-items for a single item. In flexbox it aligns the item on the cross axis, and in grid it aligns it inside its grid area. The validator accepts auto, normal, stretch, center, start, end, self-start, self-end, flex-start, flex-end and the baseline keywords (baseline, first baseline, last baseline), with an optional safe or unsafe before a position. Typical mistakes are middle for center, left or right (only justify-self takes those), and space-between, which belongs to align-content. Browsers drop a declaration with an unknown value, so the item falls back to whatever align-items says.
anchor-center is a different case. The CSS Anchor Positioning module adds it to align-self so an absolutely positioned element can center on its anchor, such as a tooltip under a button. The validator doesn't know the keyword yet and flags it even inside an @supports block. On an element that isn't absolutely positioned or has no default anchor, the spec says anchor-center behaves as center, so on an ordinary flex or grid item you can swap it for center without changing the layout.
If the element is anchor positioned and needs anchor-center, keep it and mute this message for that value.
Invalid example
<div style="display: flex; height: 160px;">
<p style="align-self: middle;">Caption</p>
<p style="align-self: anchor-center;">Price</p>
</div>
Valid example
<div style="display: flex; height: 160px;">
<p style="align-self: center;">Caption</p>
<p style="align-self: center;">Price</p>
</div>
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries