<!-- Developed by http://grohit.com/ -->
<div>Filling the text on hover</div>
<p data-item='Rohit'>Rohit</p>
<section>
<div>Real time example, Navbar:</div>
<nav>
<ul class="menuItems">
<li><a href='#' data-item='Home'>Home</a></li>
<li><a href='#' data-item='About'>About</a></li>
<li><a href='#' data-item='Projects'>Projects</a></li>
<li><a href='#' data-item='Blog'>Blog</a></li>
<li><a href='#' data-item='Contact'>Contact</a></li>
</ul>
</nav>
</section>
<!-- Footer starts-->
<footer>
<!-- Copyright -->
<!-- ❤️ -->
<div class="footer-copyright text-center">© Developed with ❤️</i> by
<a href="https://grohit.com/" class="white-text" target="_blank">G Rohit</a>. <a href="https://codepen.io/grohit/" target="_blank">Check my other pens </a>
</div>
<!-- Copyright -->
</footer>
<!-- Footer ends-->
<!-- Developed by http://grohit.com/ -->
* {
padding: 0;
margin: 0;
}
// Developed by http://grohit.com/
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
min-height: 100vh;
font-family: Hack, monospace;
}
div {
color: #727272;
text-align: center;
}
p {
margin: 16px;
font-size: 96px;
color: #ccc;
text-transform: uppercase;
font-weight: 600;
transition: all 1s ease-in-out;
position: relative;
&::before {
content: attr(data-item);
transition: all 1s ease-in-out;
color: #8254ff;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 0;
overflow: hidden;
}
&:hover {
&::before {
width: 100%;
}
}
}
nav {
margin: 25px;
background: #f9f9f9;
padding: 16px;
.menuItems {
list-style: none;
display: flex;
li {
margin: 50px;
a {
text-decoration: none;
color: #8f8f8f;
font-size: 24px;
font-weight: 400;
transition: all 0.5s ease-in-out;
position: relative;
text-transform: uppercase;
&::before {
content: attr(data-item);
transition: 0.5s;
color: #8254ff;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 0;
overflow: hidden;
}
&:hover {
&::before {
width: 100%;
transition: all 0.5s ease-in-out;
}
}
}
}
}
}
// Developed by http://grohit.com/
footer {
position: absolute;
font-size: 12px;
bottom: 0;
width: 100%;
height: 60px;
line-height: 60px;
font-size: 14px;
background-color: #f1f1f1;
color: #000000;
text-align: center;
a {
text-decoration: none;
color: inherit;
border-bottom: 1px solid;
&:hover {
border-bottom: 1px transparent;
}
}
}
View Compiled
// no JS today :D
This Pen doesn't use any external JavaScript resources.