<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/assets/reset.css" rel="stylesheet">
<link href="setup.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body>
<section>
<h2>Line/<wbr>bounding box</h2>
</section>
<section>
<h2 class="precise">Much better!</h2>
</section>
</body>
</html>
h2 {
background-color: hsla(200, 100%, 50%, 33%);
}
.precise::before,
.precise::after {
content: '';
display: block;
visibility: hidden;
}
.precise::before { margin-top: var(--inset--top); }
.precise::after { margin-bottom: var(--inset--bottom); }
.precise {
--inset--top: -0.2em;
--inset--bottom: -0.23em;
--inset--left: -0.07em;
--inset--right: -0.06em;
display: flow-root;
margin-left: var(--inset--left);
margin-right: var(--inset--right);
width: fit-content;
}