Skip to content

Instantly share code, notes, and snippets.

@specious
Created June 19, 2014 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save specious/418a090ab700d5df28ae to your computer and use it in GitHub Desktop.
Save specious/418a090ab700d5df28ae to your computer and use it in GitHub Desktop.
Pure CSS glass sphere
.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%;
}
<div id="ball">
<img src="http://troubled.pro/img/octocat.svg">
<div class="glass"></div>
<div>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
@specious
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment