I have a button and inside it I have a i
tag with an icon of font-awesome
and inside i
a span
with text (without span
icone was on top and text below).
WhatIneedisawaytopositionthisspan
4pxupbecauseithas20pxawayfromthetopandonly16pxstrong>distancefromthebottom.Padding
andmargim
havenoeffectonthisspan
li {
list-style-type: none;
}
.button-entrar {
color: black;
display: inline-block;
padding: .7rem 2rem;
text-align: center;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
font-size: 1rem;
border-radius: .3rem;
transition: all 500ms ease;
cursor: pointer;
text-transform: uppercase;
padding: .7rem 3rem;
font-size: 1.2rem;
}
.button-entrar::before,
.button-entrar::after {
content: "";
width: 0;
height: 2px;
position: absolute;
transition: all 0.2s linear;
background: black;
}
.button-entrar span::before,
.button-entrar span::after {
content: "";
width: 2px;
height: 0;
position: absolute;
transition: all 0.2s linear;
background: black;
}
.button-entrar:hover::before,
.button-entrar:hover::after {
width: 100%;
}
.button-entrar:hover span::before,
.button-entrar:hover span::after {
height: 100%;
}
.button-entrar::after {
right: 0;
bottom: 0;
transition-duration: 0.4s;
}
.button-entrar span::after {
right: 0;
bottom: 0;
transition-duration: 0.4s;
}
.button-entrar::before {
left: 0;
top: 0;
transition-duration: 0.4s;
}
.button-entrar span::before {
left: 0;
top: 0;
transition-duration: 0.4s;
}
.button-entrar:hover {
color: black;
transition: all 500ms ease;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<li class="nav-item">
<a class="js-scroll button-entrar" href="#"><i class="fas fa-sign-in-alt"><span class="pl-4">Entrar</span></i></a>
</li>