How to Create CSS Custom Text Underline

Web Design & Web Development


Sponsored links




<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Custom Text Underline</title>
    <link rel="stylesheet" type="text/css" href="">
    <link rel="stylesheet" href="">
    <link rel="stylesheet" type="text/css" href="style.css">
    <div id="container">
      <div class="text">
        <p class="underline-01">Text Underline</p>
        <p class="underline-02">Text Underline</p>
        <p class="underline-03">Text Underline</p>
        <p class="underline-04">Text Underline</p>
        <p class="underline-05">Text Underline</p>
        <p class="underline-06">Text Underline</p>


@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
html {
  font-size: 16px;
body {
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
#container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: 20px;
.text p {
  margin: 10px 0 10px;
  color: #413832;
  font-size: 2.5rem;
  text-align: center;
.underline-01 {
  -webkit-text-decoration: underline solid #413832;
  text-decoration: underline solid #413832;
.underline-02 {
  -webkit-text-decoration: underline double #b373B3;
  text-decoration: underline double #b373B3;
.underline-03 {
  -webkit-text-decoration: underline dotted #59bfb3;
  text-decoration: underline dotted #59bfb3;
.underline-04 {
  -webkit-text-decoration: underline dashed #f2a640;
  text-decoration: underline dashed #f2a640;
.underline-05 {
  -webkit-text-decoration: underline wavy #22a4be;
  text-decoration: underline wavy #22a4be;
.underline-06 {
  background-image: linear-gradient(90deg, #e67399, #f2a640);
  background-position: bottom;
  background-size: 100% 30%;
  background-repeat: no-repeat;
@media screen and (max-width: 480px) {
  #container {
    height: auto;
    align-items: flex-start;
  .text p {
    font-size: 2rem;