Outline vs Border
The outline property looks similar to border but behaves very differently. Understanding the differences is crucial for accessibility and layout.
Key Differences
- Outlines do not take up space — they overlay content outside the border box without affecting layout.
- Outlines are drawn outside the border.
- Outlines cannot be styled per-side (no
outline-left). - Outlines are rendered during focus for accessibility by browsers automatically.
outline-offset
Moves the outline away from the border edge by a specified distance. Negative values draw the outline inside the element.
Accessibility
Never set outline: none without providing an alternative visible focus indicator — doing so harms keyboard users.