Skip to content

Instantly share code, notes, and snippets.

@markbrown4
Created January 2, 2012 20:47
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 markbrown4/1552038 to your computer and use it in GitHub Desktop.
Save markbrown4/1552038 to your computer and use it in GitHub Desktop.
Cute little value previewers
/* Cute little value previewers */
.previewer {
position: absolute;
border-radius: 8px;
box-shadow: 1px 1px 8px rgba(0,0,0,.7);
}
/* tick */
.previewer:before {
content: '';
position: absolute;
bottom: -6px; /* move half the width left to center */
left: 50%; /* left edge at center */
width: 12px;
height: 12px;
border: inherit;
margin-left: -6px; /* drag left 6px (half the width) to center */
background: white;
transform: rotate(45deg); /* make a square a triangle */
box-shadow: inherit;
}
/* content canvas of the previewer */
.previewer:after {
content: '';
position: absolute;
/* make edges touch parent elements, match dimensions */
top: 0; right: 0; bottom: 0; left: 0;
border: 5px solid white;
border-radius: inherit;
box-shadow: 1px 1px 5px rgba(0,0,0,.5) inset;
}
/* each type of previewer has it's own dimensions */
#color { width: 50px; height: 50px }
<div id="color" class="previewer"></div>
{"view":"split","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment