Skip to content

Instantly share code, notes, and snippets.

@f8lrebel
Created July 1, 2012 05:04
Show Gist options
  • Save f8lrebel/3026889 to your computer and use it in GitHub Desktop.
Save f8lrebel/3026889 to your computer and use it in GitHub Desktop.
A web page created at CodePen.io
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Pure CSS Scalable Media Buttons made with LESS &middot; CodePen</title>
<style>
menu {
/* @size sets the relative size of the buttons, define before calling the buttons mixin */
/* Play */
/* Stop */
/* Fast-Forward */
/* Rewind */
/* Pause */
margin: 2em auto;
text-align: center;
position: relative;
}
menu button {
position: relative;
display: inline-block;
padding: .6em;
background: linear-gradient(top, #ffffff, #cccccc), #c9c5c9;
border-radius: 10em;
border: 0 solid #d0d0d0;
width: 8em;
height: 8em;
margin-right: 20px;
box-shadow: 0 0.48em 0.56em rgba(0, 0, 0, 0.4);
}
menu button:hover {
background: linear-gradient(top, #f5f5f5, #b9b9b9), #c9c5c9;
}
menu button:before,
menu button:after {
position: absolute;
content: " ";
}
menu button:active {
margin-top: 0.4em;
margin-bottom: -0.4em;
box-shadow: 0 0.16em 0.24em rgba(0, 0, 0, 0.4);
}
menu .play:before {
z-index: 2;
top: 1.76em;
left: 2.88em;
width: 0;
height: 0;
border: 2.4em solid transparent;
border-left-color: rgba(100, 100, 100, 0.8);
border-left-width: 3.6em;
}
menu .play:hover:before {
border-left-color: rgba(36, 36, 36, 0.8);
}
menu .stop:before {
top: 2.24em;
left: 2.24em;
width: 3.76em;
height: 3.76em;
background: rgba(100, 100, 100, 0.8);
}
menu .stop:hover:before {
background: rgba(36, 36, 36, 0.8);
}
menu .ff:before,
menu .ff:after {
width: 0;
height: 0;
top: 2.08em;
border: 2em solid transparent;
border-left-color: rgba(100, 100, 100, 0.8);
border-left-width: 2.24em;
}
menu .ff:before {
left: 2.4em;
}
menu .ff:after {
left: 4.528em;
content: " ";
}
menu .ff:hover:before,
menu .ff:hover:after {
border-left-color: rgba(36, 36, 36, 0.8);
}
menu .rw:before,
menu .rw:after {
width: 0;
height: 0;
top: 2.08em;
border: 2em solid transparent;
border-right-color: rgba(100, 100, 100, 0.8);
border-right-width: 2.16em;
}
menu .rw:before {
left: 1.76em;
}
menu .rw:after {
left: -0.4em;
content: " ";
}
menu .rw:hover:after,
menu .rw:hover:before {
border-right-color: rgba(36, 36, 36, 0.8);
}
menu .pause:before,
menu .pause:after {
height: 3.76em;
width: 1.52em;
left: 2.32em;
top: 2.24em;
display: block;
background-color: rgba(100, 100, 100, 0.8);
}
menu .pause:after {
left: 4.32em;
}
menu .pause:hover:before,
menu .pause:hover:after {
background-color: rgba(36, 36, 36, 0.8);
}
menu.medium {
/* Play */
/* Stop */
/* Fast-Forward */
/* Rewind */
/* Pause */
}
menu.medium button {
position: relative;
display: inline-block;
padding: .6em;
background: linear-gradient(top, #ffffff, #cccccc), #c9c5c9;
border-radius: 10em;
border: 0 solid #d0d0d0;
width: 5em;
height: 5em;
margin-right: 20px;
box-shadow: 0 0.3em 0.35000000000000003em rgba(0, 0, 0, 0.4);
}
menu.medium button:hover {
background: linear-gradient(top, #f5f5f5, #b9b9b9), #c9c5c9;
}
menu.medium button:before,
menu.medium button:after {
position: absolute;
content: " ";
}
menu.medium button:active {
margin-top: 0.25em;
margin-bottom: -0.25em;
box-shadow: 0 0.1em 0.15em rgba(0, 0, 0, 0.4);
}
menu.medium .play:before {
z-index: 2;
top: 1.1em;
left: 1.7999999999999998em;
width: 0;
height: 0;
border: 1.5em solid transparent;
border-left-color: rgba(100, 100, 100, 0.8);
border-left-width: 2.25em;
}
menu.medium .play:hover:before {
border-left-color: rgba(36, 36, 36, 0.8);
}
menu.medium .stop:before {
top: 1.4000000000000001em;
left: 1.4000000000000001em;
width: 2.3499999999999996em;
height: 2.3499999999999996em;
background: rgba(100, 100, 100, 0.8);
}
menu.medium .stop:hover:before {
background: rgba(36, 36, 36, 0.8);
}
menu.medium .ff:before,
menu.medium .ff:after {
width: 0;
height: 0;
top: 1.3em;
border: 1.25em solid transparent;
border-left-color: rgba(100, 100, 100, 0.8);
border-left-width: 1.4000000000000001em;
}
menu.medium .ff:before {
left: 1.5em;
}
menu.medium .ff:after {
left: 2.8299999999999996em;
content: " ";
}
menu.medium .ff:hover:before,
menu.medium .ff:hover:after {
border-left-color: rgba(36, 36, 36, 0.8);
}
menu.medium .rw:before,
menu.medium .rw:after {
width: 0;
height: 0;
top: 1.3em;
border: 1.25em solid transparent;
border-right-color: rgba(100, 100, 100, 0.8);
border-right-width: 1.35em;
}
menu.medium .rw:before {
left: 1.1em;
}
menu.medium .rw:after {
left: -0.25em;
content: " ";
}
menu.medium .rw:hover:after,
menu.medium .rw:hover:before {
border-right-color: rgba(36, 36, 36, 0.8);
}
menu.medium .pause:before,
menu.medium .pause:after {
height: 2.3499999999999996em;
width: 0.95em;
left: 1.45em;
top: 1.4000000000000001em;
display: block;
background-color: rgba(100, 100, 100, 0.8);
}
menu.medium .pause:after {
left: 2.7em;
}
menu.medium .pause:hover:before,
menu.medium .pause:hover:after {
background-color: rgba(36, 36, 36, 0.8);
}
menu.small {
/* Play */
/* Stop */
/* Fast-Forward */
/* Rewind */
/* Pause */
}
menu.small button {
position: relative;
display: inline-block;
padding: .6em;
background: linear-gradient(top, #ffffff, #cccccc), #c9c5c9;
border-radius: 10em;
border: 0 solid #d0d0d0;
width: 3em;
height: 3em;
margin-right: 20px;
box-shadow: 0 0.18em 0.21000000000000002em rgba(0, 0, 0, 0.4);
}
menu.small button:hover {
background: linear-gradient(top, #f5f5f5, #b9b9b9), #c9c5c9;
}
menu.small button:before,
menu.small button:after {
position: absolute;
content: " ";
}
menu.small button:active {
margin-top: 0.15000000000000002em;
margin-bottom: -0.15000000000000002em;
box-shadow: 0 0.06em 0.09em rgba(0, 0, 0, 0.4);
}
menu.small .play:before {
z-index: 2;
top: 0.66em;
left: 1.08em;
width: 0;
height: 0;
border: 0.8999999999999999em solid transparent;
border-left-color: rgba(100, 100, 100, 0.8);
border-left-width: 1.35em;
}
menu.small .play:hover:before {
border-left-color: rgba(36, 36, 36, 0.8);
}
menu.small .stop:before {
top: 0.8400000000000001em;
left: 0.8400000000000001em;
width: 1.41em;
height: 1.41em;
background: rgba(100, 100, 100, 0.8);
}
menu.small .stop:hover:before {
background: rgba(36, 36, 36, 0.8);
}
menu.small .ff:before,
menu.small .ff:after {
width: 0;
height: 0;
top: 0.78em;
border: 0.75em solid transparent;
border-left-color: rgba(100, 100, 100, 0.8);
border-left-width: 0.8400000000000001em;
}
menu.small .ff:before {
left: 0.8999999999999999em;
}
menu.small .ff:after {
left: 1.698em;
content: " ";
}
menu.small .ff:hover:before,
menu.small .ff:hover:after {
border-left-color: rgba(36, 36, 36, 0.8);
}
menu.small .rw:before,
menu.small .rw:after {
width: 0;
height: 0;
top: 0.78em;
border: 0.75em solid transparent;
border-right-color: rgba(100, 100, 100, 0.8);
border-right-width: 0.81em;
}
menu.small .rw:before {
left: 0.66em;
}
menu.small .rw:after {
left: -0.15000000000000002em;
content: " ";
}
menu.small .rw:hover:after,
menu.small .rw:hover:before {
border-right-color: rgba(36, 36, 36, 0.8);
}
menu.small .pause:before,
menu.small .pause:after {
height: 1.41em;
width: 0.5700000000000001em;
left: 0.8699999999999999em;
top: 0.8400000000000001em;
display: block;
background-color: rgba(100, 100, 100, 0.8);
}
menu.small .pause:after {
left: 1.62em;
}
menu.small .pause:hover:before,
menu.small .pause:hover:after {
background-color: rgba(36, 36, 36, 0.8);
}
/*
The buttons mixin that defines the buttons styles, the @size must be defined to set the relative size
*/
/*
Other Styles
*/
body {
background: #c1c1c1;
}
</style>
<style>
#codepen-footer, #codepen-footer * {
-webkit-box-sizing: border-box !important;
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
}
#codepen-footer {
display: block !important;
position: fixed !important;
bottom: 0 !important;
left: 0 !important;
width: 100% !important;
padding: 0 10px !important;
margin: 0 !important;
height: 30px !important;
line-height: 30px !important;
font-size: 12px !important;
color: #eeeeee !important;
background-color: #505050 !important;
text-align: left !important;
background: -webkit-linear-gradient(top, #505050, #383838) !important;
background: -moz-linear-gradient(top, #505050, #383838) !important;
background: -ms-linear-gradient(top, #505050, #383838) !important;
background: -o-linear-gradient(top, #505050, #383838) !important;
border-top: 1px solid black !important;
border-bottom: 1px solid black !important;
border-radius: 0 !important;
border-image: none !important;
box-shadow: inset 0 1px 0 #6e6e6e, 0 2px 2px rgba(0, 0, 0, 0.4) !important;
z-index: 300 !important;
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, sans-serif !important;
letter-spacing: 0 !important;
word-spacing: 0 !important;
}
#codepen-footer a {
color: #a7a7a7 !important;
text-decoration: none !important;
}
#codepen-footer a:hover {
color: white !important;
}
</style>
<script>
// Kill alerts, confirmations and prompts
window.alert = function(){};
window.confirm = function(){};
window.prompt = function(){};
window.open = function(){};
window.print = function(){};
</script>
<script src="http://codepen.io/javascripts/libs/prefixfree.min.js"></script>
</head>
<body>
<menu>
<button class="rw"></button>
<button class="play"></button>
<button class="pause"></button>
<button class="stop"></button>
<button class="ff"></button>
</menu>
<menu class="medium">
<button class="rw"></button>
<button class="play"></button>
<button class="pause"></button>
<button class="stop"></button>
<button class="ff"></button>
</menu>
<menu class="small">
<button class="rw"></button>
<button class="play"></button>
<button class="pause"></button>
<button class="stop"></button>
<button class="ff"></button>
</menu>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://codepen.io/javascripts/libs/modernizr.js"></script>
<div id="codepen-footer">
<a style="color: #f73535 !important;" href="https://codepen.wufoo.com/forms/m7x3r3/def/field14=" onclick="window.open(this.href, null, 'height=517, width=680, toolbar=0, location=0, status=1, scrollbars=1, resizable=1'); return false">Report Abuse</a>
&nbsp;
<a href="/f8lrebel/pen/2/1">Edit this Pen</a>
</div>
</body>
</html>
<menu>
<button class="rw"></button>
<button class="play"></button>
<button class="pause"></button>
<button class="stop"></button>
<button class="ff"></button>
</menu>
<menu class="medium">
<button class="rw"></button>
<button class="play"></button>
<button class="pause"></button>
<button class="stop"></button>
<button class="ff"></button>
</menu>
<menu class="small">
<button class="rw"></button>
<button class="play"></button>
<button class="pause"></button>
<button class="stop"></button>
<button class="ff"></button>
</menu>
@color: rgba(100,100,100,.8);
@color-dark: darken(@color, 25%);
menu {
/* @size sets the relative size of the buttons, define before calling the buttons mixin */
@size: 8em;
.buttons;
margin: 2em auto;
text-align: center;
position: relative;
}
menu.medium {
@size: 5em;
.buttons;
}
menu.small {
@size: 3em;
.buttons;
}
/*
The buttons mixin that defines the buttons styles, the @size must be defined to set the relative size
*/
.buttons() {
button {
position: relative;
display: inline-block;
padding: .6em;
background: linear-gradient(top, #fff, #ccc), #c9c5c9 ;
border-radius: 10em;
border: 0 solid rgba(208,208,208,1.000);
width: @size;
height: @size;
margin-right: 20px;
box-shadow: 0 @size * .06 @size * .07 rgba(0,0,0,.4);
}
button:hover {
background: linear-gradient(top, #f5f5f5, #b9b9b9), #c9c5c9 ;
}
button:before, button:after {
position: absolute;
content: " ";
}
button:active {
margin-top: @size * .05;
margin-bottom: @size * -.05;
box-shadow: 0 @size * .02 @size * .03 rgba(0,0,0,.4);
}
/* Play */
.play:before {
z-index: 2;
top: @size * .22;
left: @size * .36;
width: 0;
height: 0;
border: @size * .3 solid transparent;
border-left-color: @color;
border-left-width: @size * .45;
}
.play:hover:before {
border-left-color: @color-dark;
}
/* Stop */
.stop:before {
top: @size * .28;
left: @size * .28;
width: @size * .47;
height: @size * .47;
background: @color;
}
.stop:hover:before {
background: @color-dark;
}
/* Fast-Forward */
.ff:before, .ff:after {
width: 0;
height: 0;
top: @size * .26;
border: @size * .25 solid transparent;
border-left-color: @color;
border-left-width: @size * .28;
}
.ff:before {
left: @size * .3em;
}
.ff:after {
left: @size * .566em;
content: " "
}
.ff:hover:before, .ff:hover:after {
border-left-color: @color-dark;
}
/* Rewind */
.rw:before, .rw:after {
width: 0;
height: 0;
top: @size * .26;
border: @size * .25 solid transparent;
border-right-color: @color;
border-right-width: @size * .27;
}
.rw:before {
left: @size * .22;
}
.rw:after {
left: @size * -.05;
content: " "
}
.rw:hover:after, .rw:hover:before {
border-right-color: @color-dark;
}
/* Pause */
.pause:before, .pause:after {
height: @size * .47;
width: @size * .19;
left: @size * .29;
top: @size * .28;
display: block;
background-color: @color;
}
.pause:after {
left: @size * .54;
}
.pause:hover:before, .pause:hover:after {
background-color: @color-dark;
}
}
/*
Other Styles
*/
body {
background: #c1c1c1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment