Skip to content

Instantly share code, notes, and snippets.

@exarcheia-web
Created November 12, 2013 18:31
Show Gist options
  • Save exarcheia-web/7436222 to your computer and use it in GitHub Desktop.
Save exarcheia-web/7436222 to your computer and use it in GitHub Desktop.
Pseudo element - Demo
/* Pseudo element - Demo */
* {box-sizing: border-box}
.box {
width: 300px;
height: 200px;
background: hotpink;
text-align: center;
color: white;
font-family: Georgia;
font-size: 2.5em;
padding: 30px;
margin: 70px auto;
position: relative;
}
.box:before {
content: "";
display: block;
width: 280px;
height: 150px;
background: rgb(0,0,255);
position: absolute;
left: 10px;
top: -20px;
z-index: -1;
animation: before 1s;
}
.box:after {
content: "";
display: block;
width: 260px;
height: 150px;
background: rgba(0,255,255,0.4);
position: absolute;
left: 20px;
top: -35px;
z-index: -2;
animation: after 1s;
}
@keyframes after {
from {
top: -35px;
width: 260px;
}
to {
top: -50px;
width: 240px;
}
}
@keyframes before {
from {
top: -20px;
width: 280px;
}
to {
top: -35px;
width: 260px;
}
}
<div class="box">Multiple Backgrounds</div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment