A wavy underline in CSS

Amelie P picture Amelie P · Jan 26, 2015 · Viewed 21.2k times · Source

Can I create a wavy underline as this : http://i.imgur.com/aiBjQry.png
I can only get a solid border :

.err {
  border-bottom:1px solid red;
  display: inline-block;
}
<div>A boy whose name was Peter was <div class="err">woking</div> down the street</div>

Answer

The Pragmatick picture The Pragmatick · Jan 26, 2015

Without background image:

.err {
  display: inline-block;
  position: relative;
}
.err:before {
  content: "~~~~~~~~~~~~";
  font-size: 0.6em;
  font-weight: 700;
  font-family: Times New Roman, Serif;
  color: red;
  width: 100%;
  position: absolute;
  top: 12px;
  left: -1px;
  overflow: hidden;
}
<div>A boy whose name was Peter was
  <div class="err">woking</div> down the street</div>

With Background image :

.err {
    display: inline-block;
    position:relative;
    background: url(http://i.imgur.com/HlfA2is.gif) bottom repeat-x;
}
<div>A boy whose name was Peter was <div class="err">woking</div> down the street</div>