Skip to content


Pretty text underline

Provides a nicer alternative to text-decoration: underline where descenders do not clip the underline.

💡 Tip

This is natively implemented as text-decoration-skip-ink: auto but it has less control over the underline.

<div class="container">
  <p class="pretty-text-underline">Pretty text underline without clipping descenders.</p>
.container {
  background: #f5f6f9;
  color: #333;
  padding: 8px 0;

.pretty-text-underline {
  display: inline;
  text-shadow: 1px 1px #f5f6f9, -1px 1px #f5f6f9, -1px -1px #f5f6f9,
    1px -1px #f5f6f9;
  background-image: linear-gradient(90deg, currentColor 100%, transparent 100%);
  background-position: bottom;
  background-repeat: no-repeat;
  background-size: 100% 1px;

.pretty-text-underline::selection {
  background-color: rgba(0, 150, 255, 0.3);
  text-shadow: none;

More like this

Start typing a keyphrase to see matching snippets.