Reputation: 261
Can I create a wavy underline as this :
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>
Upvotes: 24
Views: 34979
Reputation: 500
You could use the CSS text-decoration-style
property:
-webkit-text-decoration-style: wavy;
-moz-text-decoration-style: wavy;
text-decoration-style: wavy;
This works in all major browsers (except IE — if you need to support that then you may need to consider using a image instead)
Upvotes: 24
Reputation: 4686
Below is an example of one of the ways that you can achieve that without an image. Adjust as needed.
.err {
border-bottom:2px dotted red;
display: inline-block;
position: relative;
}
.err:after {
content: '';
width: 100%;
border-bottom:2px dotted red;
position: absolute;
font-size: 16px;
top: 15px; /* Must be font-size minus one (16px - 1px) */
left: -2px;
display: block;
height: 4px;
}
<div>A boy whose name was Peter was <div class="err">woking</div> down the street</div>
Upvotes: 35
Reputation: 5477
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>
Upvotes: 42
Reputation: 682
You can use a :after
pseudo-element on the link and set a repeat-x background of a wave image.
You can also use the border-image
CSS3 property, but this is not fully supported for old browsers
Upvotes: 0