.fieldset { position: relative; border: 1px solid #ddd; padding: 10px; } .fieldset h1 { position: absolute; top: 0; font-size: 18px; line-height: 1; margin: -9px 0 0; /* half of font-size */ background: #fff; padding: 0 3px; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter