Created
June 19, 2014 06:35
-
-
Save specious/418a090ab700d5df28ae to your computer and use it in GitHub Desktop.
Pure CSS glass sphere
This file contains 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
.glass { | |
background-image: | |
radial-gradient(circle closest-side, rgba(167, 162, 162, 0.33), rgba(0, 0, 0, 0.62)); | |
background-size: 100%; | |
border-radius: 50%; | |
position: relative; | |
} | |
.glass::before { | |
position: absolute; | |
width: 56%; | |
height: 26%; | |
top: 4%; | |
left: 22%; | |
border-radius: 50%; | |
background-image: | |
linear-gradient(to bottom, rgba(231, 231, 231, 0.12), rgba(30, 30, 30, 0.16)); | |
content: ''; | |
} | |
.glass::after { | |
position: absolute; | |
width: 38%; | |
height: 19%; | |
bottom: 3%; | |
left: 31%; | |
border-radius: 50%; | |
background-image: | |
linear-gradient(to bottom, rgba(93, 93, 93, 0.06), rgba(0, 0, 0, 0.18)); | |
content: ''; | |
} | |
/* | |
* Presentation | |
*/ | |
html { | |
height: 100%; | |
} | |
body { | |
margin: 0; | |
height: 100%; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
#ball { | |
width: 420px; | |
height: 420px; | |
background-color: red; | |
border-radius: 50%; | |
} | |
#ball > img { | |
width: 300px; | |
height: 300px; | |
margin: 60px; | |
position: absolute; | |
} | |
.glass { | |
width: 100%; | |
height: 100%; | |
} |
This file contains 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 id="ball"> | |
<img src="http://troubled.pro/img/octocat.svg"> | |
<div class="glass"></div> | |
<div> |
This file contains 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 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
View dabblet: http://dabblet.com/gist/418a090ab700d5df28ae