<html>
<head>
<meta charset=utf-8 />
<title>Scalable icons using background-sizing</title>
</head>
<body class="document" onload="zoomElm(document.getElementById('results'),slider.value)"">
<h1><a href="#">Scalable icons using <code>background-sizing</code></a></h1>
<div class="overlay">
<div id="toolbar">
<span>Scale:</span> <input id="slider" type="range" min="1" max="4" step="0.15" value="3" onchange="zoomElm(document.getElementById('results'),this.value)" >
</div>
</div>
<div id="container">
<section id="results">
<span class="icon tick"></span>
</section>
</div>
</body>
</html>
/* Reset */
html {
font-smoothing: antialiased;
}
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
line-height: 1;
}
.document {
color: #999;
font-family: "Helvetica", Arial, Helvetica, sans-serif;
font-size: 22px;
}
.icon {
background-size: 300%;
width: 32px;
height: 32px;
display: inline-block;
background-image: url(http://ux.globaldev.co.uk/box-sizing-test/icons/icons.png);
}
.icon.tick {
background-position: 50% 100%;
}
h1 {
font-size: 22px;
font-weight: normal;
padding: 24px;
display: block;
width: 100%;
border-bottom: 2px solid #f5f5f5;
text-align: center;
margin: 0;
}
body a {
text-decoration: none;
color: #999;
padding: 24px;
}
a:hover {
color: #666;
}
.overlay {
bottom: 0;
left: 0;
padding: 72px;
position: fixed;
width:100%;
box-sizing: border-box;
}
#toolbar {
padding:22px 20px;
background: #e5e5e5;
color: #919191;
font-size: 16px;
overflow: hidden;
border-radius: 3px;
max-width: 600px;
margin: 0 auto;
}
#toolbar span {
width: 20%;
display: block;
float: left;
}
input {
margin: 0;
vertical-align: middle;
}
#container {
height: 70%;
margin: 0 auto;
display: table;
}
#container:before {
display: block;
content: "";
height: 100%;
background: red;
display: inline-block;
vertical-align: middle;
}
#size {
text-align: center;
margin-bottom: 16px;
}
#results {
display: inline-block;
vertical-align: middle;
}
input {
appearance: none;
background-color: #919191;
width: 80%;
float: left;
height: 4px;
margin-top: 7px;
box-sizing: border-box;
border-radius: 2px;
}
input::slider-thumb {
appearance: none;
border: 4px solid #919191;
background: #e5e5e5;
width: 16px;
height: 16px;
border-radius: 10px;
}
code {
font-family: Monaco, "Lucida Console", monospace;
border: 1px solid rgba(0,0,0,0.15);
border-radius: 4px;
border-radius: 4px;
padding: 0 2px;
background: rgba(0,0,0,0.04);
font-size: 21px;}
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |