Created
March 4, 2013 12:24
-
-
Save tomax/5081927 to your computer and use it in GitHub Desktop.
Scrolling shadows by @kizmarh and @LeaVerou
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
| /** | |
| * Scrolling shadows by @kizmarh and @leaverou | |
| * Only works in browsers supporting background-attachment: local; & CSS gradients | |
| * Degrades gracefully | |
| */ | |
| html { | |
| background: white; | |
| font: 120% sans-serif; | |
| } | |
| .scrollbox { | |
| overflow: hidden; | |
| width: 200px; | |
| max-width: 200px; | |
| margin: 50px auto; | |
| background: | |
| /* Shadow covers */ | |
| linear-gradient(left, white 30%, rgba(255,255,255,0)), | |
| linear-gradient(left, rgba(255,255,255,0), white 70%) 0 100%, | |
| /* Shadows */ | |
| radial-gradient(0 50%, farthest-side, rgba(0,0,0,.2), rgba(0,0,0,0)), radial-gradient(50% 100%,farthest-side, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%; | |
| background: | |
| /* Shadow covers */ | |
| linear-gradient(left, white 30%, rgba(255,255,255,0)), | |
| linear-gradient(left, rgba(255,255,255,0), white 70%) 0 100%, | |
| /* Shadows */ | |
| radial-gradient(farthest-side at 50% 0, rgba(0,0,0,.2), rgba(0,0,0,0)), | |
| radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%; | |
| background-repeat: no-repeat; | |
| background-color: white; | |
| background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px; | |
| /* Opera doesn't support this in the shorthand */ | |
| background-attachment: local, local, scroll, scroll; | |
| } | |
| .scrollbox span { | |
| white-space: nowrap; | |
| transition: 1s; | |
| margin-left: 0; | |
| display: inline-box; | |
| } | |
| .scrollbox span:hover { | |
| margin-left:-500px; | |
| } |
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
| <h1>CSS-only horizontal shadow-scrolling effect.</h1> | |
| <div class="scrollbox"> | |
| <span>un nom de campagne tres tres long pour le faire scroller</span> | |
| </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
| {"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment