<h2 class="c-section__title">
  <span>CSS is awesome</span>
  <svg xmlns="http://www.w3.org/2000/svg" width="128" height="34.5" viewBox="0 0 128 34.5" preserveAspectRatio="none">
    <path fill="none" stroke="#d8d8d8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M127 1H33.5L1 33.5"></path>
  </svg>
</h2>

<h2 class="c-section__title c-section__title--dashed">
  <span>CSS is awesome</span>
  <svg xmlns="http://www.w3.org/2000/svg" width="128" height="34.5" viewBox="0 0 128 34.5" preserveAspectRatio="none">
    <path fill="none" stroke="#d8d8d8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M127 1H33.5L1 33.5"></path>
  </svg>
</h2>
.c-section__title {
  position: relative;
  margin: 3rem auto 16px;
  width: fit-content;
  max-width: 700px;
  display: flex;
  align-items: flex-end;
  font-size: 24px;
  color: #ca181f;
  text-align: center;
}

.c-section__title svg {
  flex: 0 0 128px;
}

.c-section__title span {
  flex: 1;
  padding-right: 8px;
  padding-left: 32px;
  padding-bottom: 8px;
  text-align: end;
  border-bottom: 2px solid #d8d8d8;
}

.c-section__title span:after,
.c-section__title span:before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d8d8d8;
}

.c-section__title span:after {
  right: 0;
  bottom: 27px;
}

.c-section__title span:before {
  left: 0;
  bottom: -6px;
}

.c-section__title--dashed {
  path {
    stroke-dasharray: 139;
    stroke-dashoffset: 0;
    transition: 0.7s;
  }

  &:hover {
    path {
      stroke-dashoffset: 139;
    }
  }
}

body {
  font-family: "system-ui";
}

*,
*:before,
*:after {
  box-sizing: border-box;
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.