HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div id="radios">
<input id="png" value="png" type="radio" name="filetype" checked="checked" class="filetype" /><label for="png"> Use PNG</label>
<input id="svg" value="svg" type="radio" name="filetype" class="filetype" /><label for="svg"> Use SVG</label>
</div>
<div id="explanation">
<p>Using SVGs for sprites results in much worse performance in browsers. Try changing between PNG and SVG in the box above and watch the framerate drop.</p>
<p>Get in touch on Twitter if you have any questions: @adrianosmond</p>
<p>Aug 23rd 2013 - this has been fixed in Chrome.</p>
<p>Mar 24th 2014 - also fixed in Firefox.</p>
</div>
<div id="container" class="png">
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
<span class="icon home-icon"></span>
<span class="icon right-arrow"></span>
<span class="icon down-arrow"></span>
<span class="icon plus-icon"></span>
<span class="icon minus-icon"></span>
<span class="icon warning-icon"></span>
<span class="icon error-icon"></span>
<span class="icon capped-icon"></span>
<span class="icon oyster-tap-icon"></span>
<span class="icon contactless-icon"></span>
<span class="icon oyster-card-icon"></span>
<span class="icon to-icon"></span>
<span class="icon card-icon"></span>
<span class="icon calendar-icon"></span>
<span class="icon document-icon"></span>
<span class="icon spreadsheet-icon"></span>
<span class="icon bullet-icon"></span>
<span class="icon form-tooltip-icon"></span>
<span class="icon crosshair-icon"></span>
<span class="icon tube-icon"></span>
<span class="icon bus-icon"></span>
<span class="icon rail-icon"></span>
<span class="icon river-icon"></span>
<span class="icon dlr-icon"></span>
<span class="icon tram-icon"></span>
<span class="icon mail-icon"></span>
<span class="icon phone-icon"></span>
<span class="icon email-icon"></span>
<span class="icon cablecar-icon"></span>
<span class="icon up-stairs-icon"></span>
<span class="icon down-stairs-icon"></span>
<span class="icon up-escalator-icon"></span>
<span class="icon down-escalator-icon"></span>
<span class="icon no-zone-1-icon"></span>
<span class="icon up-ramp-icon"></span>
<span class="icon down-ramp-icon"></span>
<span class="icon up-lift-icon"></span>
<span class="icon down-lift-icon"></span>
<span class="icon accessible-icon"></span>
<span class="icon inverse-accessible-icon"></span>
<span class="icon pushchair-icon"></span>
<span class="icon luggage-icon"></span>
<span class="icon elderly-icon"></span>
<span class="icon disabled-icon"></span>
<span class="icon headphones-icon"></span>
<span class="icon family-icon"></span>
</div>
@import "compass/css3";
body {
font-family: Arial, sans-serif;
}
#container {
max-width: 800px;
margin: 0 auto;
}
#radios, #explanation {
position: fixed;
background-color: #fff;
border: 1px solid #ccc;
}
#radios {
padding: 15px;
}
#explanation {
top: 100px;
width: 200px;
padding: 0 15px;
}
#png, label[for='png'] {
margin-bottom: 15px;
}
label:after {
content:"";
display: block;
}
$icon-width: 32px;
$icon-height: 32px;
$sprite-rows: 42;
$sprite-cols: 3;
@mixin sprite-position($row, $col) {
background-position: (-1 * $icon-width * ($col - 1) ) (-1 * $icon-height * ($row - 1));
}
.icon {
float: left;
margin: 10px;
background-image: url('http://adrianosmond.com/images/sprite.png');
background-size: $sprite-cols*$icon-width $sprite-rows*$icon-height;
width: $icon-width;
height: $icon-height;
display: block;
&.vertically-centred {
margin-top: -1 * ($icon-height / 2);
}
}
.svg .icon {
background-image: url('http://adrianosmond.com/images/sprite.svg');
}
.home-icon {
@include sprite-position(4, 2);
}
.right-arrow {
@include sprite-position(21, 1);
right: 0;
}
.down-arrow {
@include sprite-position(22, 1);
}
.plus-icon {
@include sprite-position(23, 1);
}
.minus-icon {
@include sprite-position(24, 1);
}
.warning-icon {
@include sprite-position(27, 1);
}
.error-icon {
@include sprite-position(27, 2);
}
.capped-icon {
@include sprite-position(42, 3);
}
.expand-collapse-icon {
@include sprite-position(23, 2);
}
.oyster-icon {
@include sprite-position(15,3);
}
.oyster-tap-icon {
@include sprite-position(14,3);
}
.contactless-icon {
@include sprite-position(13,3);
}
.oyster-card-icon {
@include sprite-position(41,1);
}
.to-icon {
@include sprite-position(41,2);
}
.card-icon {
@include sprite-position(40,3);
}
.calendar-icon {
@include sprite-position(41,3);
}
.tick-icon {
@include sprite-position(7,2);
}
.document-icon {
@include sprite-position(7,3);
}
.spreadsheet-icon {
@include sprite-position(6,3);
}
.bullet-icon {
@include sprite-position(37,1);
}
.form-tooltip-icon {
@include sprite-position(12,3);
}
.crosshair-icon {
@include sprite-position(1,1);
}
.tube-icon {
@include sprite-position(34,1);
}
.bus-icon {
@include sprite-position(11,1);
}
.rail-icon {
@include sprite-position(12,1);
}
.river-icon {
@include sprite-position(13,1);
}
.dlr-icon {
@include sprite-position(14,1);
}
.tram-icon {
@include sprite-position(15,1);
}
.mail-icon {
@include sprite-position(37,3);
}
.phone-icon {
@include sprite-position(39,3);
}
.email-icon {
@include sprite-position(38,3);
}
.cablecar-icon {
@include sprite-position(16,1);
}
.up-stairs-icon {
@include sprite-position(28,1);
}
.down-stairs-icon {
@include sprite-position(29,1);
}
.up-escalator-icon {
@include sprite-position(30,1);
}
.down-escalator-icon {
@include sprite-position(31,1);
}
.no-zone-1-icon {
@include sprite-position(32,1);
}
.up-ramp-icon {
@include sprite-position(33,1);
}
.down-ramp-icon {
@include sprite-position(33,2);
}
.up-lift-icon {
@include sprite-position(33,3);
}
.down-lift-icon {
@include sprite-position(29,3);
}
.accessible-icon {
@include sprite-position(32,3);
}
.inverse-accessible-icon {
@include sprite-position(32,2);
}
.pushchair-icon {
@include sprite-position(29,2);
}
.luggage-icon {
@include sprite-position(31,2);
}
.elderly-icon {
@include sprite-position(30,2);
}
.disabled-icon {
@include sprite-position(30,3);
}
.headphones-icon {
@include sprite-position(31,3);
}
.family-icon {
@include sprite-position(28,2);
}
/*
The code here was put together very quickly in order to demonstrate the issue that all things being equal, SVG performs worse than PNG when used as background images in sprites. For more on the thought process behind this, read http://adrianosmond.com/using-svg-for-sprites-a-cautionary-tale/ or get in touch on Twitter: @adrianosmond.
*/
var $radios = $(".filetype");
var $container = $("#container");
var changeRadios = function () {
$container.attr("class", $(this).val());
};
$radios.change(changeRadios);
var scrollTime = 10000;
var scrollDown = function() {
$("html, body").animate({ scrollTop: "2000px" }, scrollTime);
};
var scrollUp = function() {
$("html, body").animate({ scrollTop: "0px" }, scrollTime);
};
scrollDown();
setInterval(scrollDown, 2 * scrollTime);
setTimeout(function() {
scrollUp()
setInterval(scrollUp, 2 * scrollTime);
}, scrollTime);
Also see: Tab Triggers