css make an underline code example
Example 1: text-decoration css
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline overline;
}
Example 2: make a underline with ::before css
.underline {
text-decoration: none;
position: relative;
}
.underline:after {
position: absolute;
content: '';
height: 2px;
bottom: -4px;
margin: 0 auto;
left: 0;
right: 0;
width: 50%;
background: green;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:.5s;
}
.underline:hover:after {
width: 80%;
background: orange;
}