How can I get the link to have a underline but the (fontawesome) icon ::before
not? ::before text decoration:none;
doesn’t work
.btn--tertiary {
font-size: 16px;
line-height: 24px;
padding-left: 0;
color: #007e9e;
text-decoration: underline;
border: 0 solid #fff;
background-color: #fff;
display: inline-flex !important;
}
.btn--tertiary::before {
font-family: "Font Awesome 5 Free";
content: "f0a9";
margin-right: 5px;
color: #9cc923;
}
div {
width: 200px;
}
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<div>
<a href="#" class="btn--tertiary">Test link 1</a>
<a href="#" class="btn--tertiary">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</a>
</div>
2
Answers
Using position absolute
You could remove the underline from the anchor-element. This way your font-awesome icon (which is part of the anchor-element) won’t be underlined as well. If you do want the rest of the text-underlined you could use a span-element for that.