I am looking to create a transition effect for when I hover over a link that will smoothly display text afterwards.
This is the current code I have:
p {
border-radius: 1em;
padding: 0.5em;
background-color: chocolate;
display: inline-block;
width: auto;
transition: width 1s;
}
p>span {
display: inline-block;
vertical-align: top;
white-space: nowrap;
overflow: hidden;
max-width: 0;
transition: all 1s;
}
p:hover>span {
max-width: 100%;
}
<p>
<a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="503a3f383e7e343f35102335222635227e333f3d">[email protected]</a>">@</a>
<span><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="177d787f7939737872576472656172653974787a">[email protected]</a></div>
</p>
While the text slides in smoothly, the background does not follow suit. How can I make the background slide as well?