Created
November 12, 2013 18:31
-
-
Save exarcheia-web/7436222 to your computer and use it in GitHub Desktop.
Pseudo element - Demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="box">Multiple Backgrounds</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // alert('Hello world!'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"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