outline never affects box sizing - it paints a ring entirely outside the border edge, offset by outline-offset, and can visually overlap surrounding content without shifting it.
solid outline: 8px solid #4a90d9 | dashed outline: 8px dashed #4a90d9 | dotted outline: 8px dotted #4a90d9 | double outline: 8px double #4a90d9 |
groove outline: 8px groove #4a90d9 | ridge outline: 8px ridge #4a90d9 | inset outline: 8px inset #4a90d9 | outset outline: 8px outset #4a90d9 |
auto (UA ring: solid, 2px, width ignored) outline: 8px auto #4a90d9 | auto, 1px declared - same ring outline: 1px auto #4a90d9 | 8px solid, for comparison outline: 8px solid #4a90d9 |
Corner dots and dashes have the same opacity as the straight runs, including on a wrapped inline outline.
dashed outline | dotted outline | dashed border | Alpha Beta Gamma wrapped inline outline |
rounded solid border-radius: 16px; outline: 8px solid #4a90d9 | rounded dashed border-radius: 16px; outline: 8px dashed #4a90d9 | rounded double border-radius: 16px; outline: 8px double #4a90d9 | rounded groove border-radius: 16px; outline: 8px groove #4a90d9 |
rounded dotted border-radius: 16px; outline: 8px dotted #4a90d9 | rounded ridge border-radius: 16px; outline: 8px ridge #4a90d9 | rounded inset border-radius: 16px; outline: 8px inset #4a90d9 | rounded outset border-radius: 16px; outline: 8px outset #4a90d9 |
The red border has exactly one rounded corner. The blue outline should follow that corner while its other three corners remain square.
top-left only border-top-left-radius: 24px; outline: 8px solid | top-right only border-top-right-radius: 24px; outline: 8px solid | bottom-right only border-bottom-right-radius: 24px; outline: 8px solid | bottom-left only border-bottom-left-radius: 24px; outline: 8px solid |
An outline on an inline element that wraps across lines is drawn as one connected shape around all of them, matching Chromium: each line's rectangle is expanded by outline-offset, the rectangles are unioned, and the outline traces the boundary of the region they cover - running around its concave corners rather than closing across each wrap. Whether the lines merge into one piece depends only on whether those expanded rectangles touch; a border is not a special case, it just makes each line's box taller, and line spacing or outline-offset each cause the overlap on their own. Border itself keeps the sliced geometry either way, staying open at internal line breaks as box-decoration-break's slice value (which does not govern outline at all) requires. Every outline style follows the merged shape: a dash pattern is fitted along each of its edges, and a bevel takes each edge's light or dark face from the direction that edge runs in - the rule that still works once the lines have merged and a per-side one no longer does.
The patterned and bevelled styles follow that same merged shape rather than restarting at each line: the dashes turn the step between two lines, and the bevel keeps one light source across the whole shape instead of relighting every line.
The red border occupies the box edge; the blue outline is a separate ring outside it. Rounded samples show both contours following the same border-radius.
solid border + solid outline border: 6px solid #d94a4a; outline: 6px solid #4a90d9 | double border + dashed outline border: 6px double #d94a4a; outline: 6px dashed #4a90d9 | groove border + double outline border: 6px groove #d94a4a; outline: 6px double #4a90d9 | inset border + outset outline border: 6px inset #d94a4a; outline: 6px outset #4a90d9 |
rounded solid + solid border: 6px solid #d94a4a; outline: 6px solid #4a90d9; border-radius: 16px | rounded double + dashed border: 6px double #d94a4a; outline: 6px dashed #4a90d9; border-radius: 16px | rounded groove + double border: 6px groove #d94a4a; outline: 6px double #4a90d9; border-radius: 16px | rounded inset + outset border: 6px inset #d94a4a; outline: 6px outset #4a90d9; border-radius: 16px |
A negative offset pulls the outline back over the border and padding; a positive offset pushes it further away.
outline-offset: -10px outline: 6px solid #d94a4a; outline-offset: -10px | outline-offset: 0 (default) outline: 6px solid #d94a4a; border: 3px solid #333 | outline-offset: 10px outline: 6px solid #d94a4a; outline-offset: 10px | large negative offset stays visible width: 30px; height: 30px; outline: 6px solid #d94a4a; outline-offset: -40px |
invert performs a true per-pixel color inversion of whatever is underneath the outline (via a PDF blend mode), not an approximation - it reads correctly over any background.
over a red background outline: 10px solid invert; outline-offset: -14px | over a green background outline: 10px solid invert; outline-offset: -14px | over a gradient outline: 10px solid invert; outline-offset: -14px |
An image, inline SVG, object, MathML formula or form control takes an outline like any other box: a ring around its border box, painted after its own background and content.
This box's outline is wider than its own padding, so it visually overlaps its siblings - but every box below sits exactly where it would if the outline were removed.