Created
September 18, 2012 10:21
-
-
Save mr-stezz/3742455 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-x: scroll; | |
overflow-y: hidden; | |
max-width: 400px; | |
height: 200px; | |
margin: auto; | |
background: | |
/* Shadow covers */ | |
linear-gradient(left, white 30%, rgba(255,255,255,0)), | |
linear-gradient(left, rgba(255,255,255,0), white 70%), | |
/* Shadows */ | |
radial-gradient( 0 50%, farthest-side, rgba(0,0,0,.2), rgba(0,0,0,0)), | |
radial-gradient(100% 50%,farthest-side, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%; | |
background-repeat: no-repeat; | |
background-position: left, right, left, right; | |
background-color: white; | |
/* width height */ | |
background-size:40px 100%, 40px 100%, 14px 100%, 14px 100%; | |
/* Opera doesn't support this in the shorthand */ | |
background-attachment: local, local, scroll, scroll; | |
} | |
.scrollbox ul { | |
list-style: none; | |
width: 1000px; | |
margin-left: 0; | |
} | |
.scrollbox li{ | |
display: inline-block; | |
} |
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 shadow-scrolling effect.</h1> | |
<div class="scrollbox"> | |
<ul> | |
<li>Ah! Scroll below!</li> | |
<li>2</li> | |
<li>3</li> | |
<li>4</li> | |
<li>5</li> | |
<li>6</li> | |
<li>7</li> | |
<li>8</li> | |
<li>9</li> | |
<li>10</li> | |
<li>1</li> | |
<li>2</li> | |
<li>3</li> | |
<li>4</li> | |
<li>5</li> | |
<li>6</li> | |
<li>7</li> | |
<li>8</li> | |
<li>9</li> | |
<li>10</li> | |
<li>1</li> | |
<li>2</li> | |
<li>3</li> | |
<li>4</li> | |
<li>5</li> | |
<li>6</li> | |
<li>7</li> | |
<li>8</li> | |
<li>The end!</li> | |
<li>No shadow there.</li> | |
</ul> | |
</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":"separate","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