A border and a non-layout outline, plus a focus-visible ring
border: 2px solid #0B5853;
border-radius: 8px;
outline: 2px dashed #1B1814;
outline-offset: 4px;The border participates in the box. The outline is offset outside it and does not add to used width. A button keeps a visible :focus-visible ring.
- No outline: none appears on :focus. Whether the dashed outline follows the 8px radius is a compatibility limit and was not measured here.
<div class="box">Border, radius, and outline</div>
<button type="button" class="action">Focusable control</button>
<style>
.box {
width: 16rem;
padding: 0.75rem;
border: 2px solid #0B5853;
border-radius: 8px;
outline: 2px dashed #1B1814;
outline-offset: 4px;
font-family: sans-serif;
}
.action {
margin-top: 1rem;
font: inherit;
border: 2px solid #0B5853;
border-radius: 8px;
background: #ffffff;
}
.action:focus-visible {
outline: 2px solid #0B5853;
outline-offset: 2px;
}
</style>What this markup means
.box has a 2px border, which is part of its box, and a dashed outline 4px outside that border, which is not part of its used width. The button uses the same radius and keeps a 2px solid outline on :focus-visible instead of removing focus visibility. box-sizing is left at its initial content-box; see the box-model page for width arithmetic.