Outlines
An outline is drawn outside the border and does not take up space or change layout. It uses outline-style, outline-width and outline-color, or the outline shorthand. outline-offset moves it away from the edge.
Browsers use outlines to show keyboard focus. Never remove them with outline: none unless you provide a clear replacement style, because keyboard users need to see where they are.
Example
<style>
button { padding: 10px 18px; margin: 10px; border: 1px solid #475569; background: white; }
button:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
.always { outline: 2px dashed #16a34a; }
</style>
<button>Tab to me</button>
<button class="always">Always outlined</button>Exercise
Add a 2px solid blue outline on focus.
input:focus { outline: 2px blue; }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.