Skip to content

Instantly share code, notes, and snippets.

@Edwardtonnn
Created November 13, 2018 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Edwardtonnn/3a49564793a96a4e6bb8376f89a6fcff to your computer and use it in GitHub Desktop.
Save Edwardtonnn/3a49564793a96a4e6bb8376f89a6fcff to your computer and use it in GitHub Desktop.
Simple Fade In Effect
<div class="container-about-us">
<ul class="white about-us">
<li><a href="#" class="text-a-about">Web Design</a></li>
<li><a href="#" class="text-a-about">Marketing</a></li>
<li><a href="#" class="text-a-about">SEO</a></li>
</ul>
</div>
/* Containers */
.container-about-us {
height: 50vh;
}
/* Elements */
/* About Us Container */
.about-us {
position: absolute;
top: 30%;
left: 50%;
transform: translate(-50%, -70%);
list-style: none;
}
.text-a-about {
color: white !important;
text-decoration: none;
font-weight: 900;
background: #232323;
padding: 15px 25px;
border-radius: 25px;
transition: 0.3s ease;
}
.text-a-about:hover {
background: var(--light-blue);
}
.about-us li {
display: inline-block;
white-space: nowrap;
}
.about-us li:not(:last-child) {
margin-right: 120px;
}
/* Web Design */
.about-us li:first-child:hover::before {
content: "";
z-index: -1;
width: auto;
height: 300px;
display: block;
position: absolute;
top: 30px;
left: 0;
right: 0;
margin: auto;
background: url(http://192.168.1.122/dev-tlg/wp-content/uploads/2018/11/web-design.png)
50% 50%;
background-size: contain;
background-repeat: no-repeat;
animation: fade-in 2s ease-in-out;
}
/* Marketing */
.about-us li:nth-child(2):hover::before {
content: "";
z-index: -1;
width: auto;
height: 300px;
display: block;
position: absolute;
top: 30px;
left: 0;
right: 0;
margin: auto;
background: url(http://192.168.1.122/dev-tlg/wp-content/uploads/2018/11/marketing.png)
50% 50%;
background-size: contain;
background-repeat: no-repeat;
animation: fade-in 2s ease-in-out;
}
/* SEO */
.about-us li:nth-child(3):hover::before {
content: "";
z-index: -1;
width: auto;
height: 300px;
display: block;
position: absolute;
top: 30px;
left: 0;
right: 0;
margin: auto;
background: url(http://192.168.1.122/dev-tlg/wp-content/uploads/2018/11/seo.png)
50% 50%;
background-size: contain;
background-repeat: no-repeat;
animation: fade-in 2s ease-in-out;
}
@keyframes fade-in {
0% {
opacity: 0;
top: 0px;
}
50% {
opacity: 1;
top: 30px;
}
100% {
opacity: 1;
top: 30px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment