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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" viewBox="0 0 500 500">
<g id="strap">
<path fill="#3C3C3B" d="M371.43 135.712C346.924 99.356 348.17 75.5 348.17 68c0-1.767-1.62-5-4.996-5H156.826c-3.374 0-4.996 3.233-4.996 5 0 7.5 1.247 31.356-23.26 67.712h41.508V76.5h159.848v59.212h41.505zM371.43 363.02c-24.507 36.355-23.26 60.21-23.26 67.71 0 1.768-1.62 5-4.996 5H156.826c-3.374 0-4.996-3.232-4.996-5 0-7.5 1.247-31.355-23.26-67.71h41.508v59.21h159.848v-59.21h41.505z"/>
<path fill="#AF6F3F" d="M170 0h160v80.833H170zM170 419.167h160V500H170z"/>
</g>
<g id="crown">
<path fill="#575756" d="M412.846 235.906h14.404v28.015h-14.404z"/>
<path fill="#3C3C3B" d="M427.25 235.906V263.92l3.403-2.607V238.513zM412.846 237.955h14.404v23.917h-14.404z"/>
<path fill="#575756" d="M412.846 240.703h14.404v18.42h-14.404z"/>
<path fill="#3C3C3B" d="M412.846 243.2h14.404v13.6h-14.404z"/>
<path fill="#575756" d="M412.846 245.805h14.404v8.39h-14.404z"/>
<path fill="#3C3C3B" d="M412.846 248.24h14.404v3.346h-14.404z"/>
</g>
<g id="face">
<circle fill="#3C3C3B" cx="249.565" cy="249.913" r="166.442"/>
<circle fill="#EDEDED" stroke="#000" stroke-width="2" stroke-miterlimit="10" cx="249.565" cy="249.913" r="156.087"/>
</g>
<g id="_x31_5_minutes" fill="#3C3C3B">
<path d="M248.33 100.027h3.34v34.056h-3.34zM173.57 120.94l2.893-1.672 17.028 29.493-2.892 1.67zM119.288 176.435l1.67-2.893 29.493 17.028-1.67 2.893zM100.027 248.288h34.056v3.34h-34.056zM120.934 326.387l-1.67-2.893 29.492-17.028 1.67 2.893zM176.436 380.675l-2.893-1.67 17.028-29.493 2.894 1.67zM248.288 365.875h3.34v34.056h-3.34zM326.39 379.026l-2.892 1.67-17.028-29.492 2.893-1.67zM380.674 323.518l-1.67 2.893-29.493-17.027 1.67-2.893zM365.875 248.33h34.056v3.34h-34.055zM379.02 173.566l1.672 2.893-29.493 17.027-1.67-2.893zM323.52 119.29l2.892 1.67-17.028 29.492-2.893-1.67z"/>
</g>
<g id="minutes" fill="#3C3C3B">
<path d="M233.833 101.05l.995-.105.627 5.967-.995.104zM218.348 103.547l.98-.208 1.246 5.868-.978.208zM203.232 107.667l.952-.31 1.854 5.708-.952.31zM188.59 113.33l.914-.406 2.44 5.48-.913.407zM161.528 129.075l.81-.588 3.526 4.854-.81.59zM149.363 138.99l.743-.67 4.015 4.458-.743.67zM138.31 150.12l.67-.744 4.458 4.015-.67.744zM128.492 162.342l.588-.81 4.854 3.527-.588.808zM112.91 189.514l.406-.913 5.48 2.44-.406.914zM107.357 204.168l.31-.95 5.706 1.853-.31.952zM103.33 219.34l.21-.977 5.867 1.247-.208.978zM100.932 234.832l.105-.995 5.967.627-.105.995zM101.043 266.168l-.105-.994 5.967-.627.105.994zM103.538 281.65l-.208-.98 5.87-1.247.207.978zM107.674 296.775l-.31-.95 5.707-1.855.31.95zM113.318 311.414l-.406-.914 5.48-2.44.407.913zM129.073 338.47l-.588-.81 4.854-3.527.587.81zM138.98 350.643l-.67-.743 4.46-4.015.668.744zM150.112 361.7l-.743-.67 4.014-4.46.743.67zM162.346 371.512l-.81-.588 3.528-4.854.81.588zM189.51 387.103l-.912-.407 2.44-5.48.913.406zM204.16 392.636l-.95-.31 1.854-5.706.95.31zM219.344 396.68l-.978-.21 1.248-5.868.978.208zM234.83 399.075l-.995-.105.627-5.967.995.105zM266.176 398.956l-.995.104-.626-5.967.995-.104zM281.658 396.465l-.978.208-1.248-5.87.978-.207zM296.77 392.32l-.952.308-1.854-5.707.95-.308zM311.426 386.678l-.914.406-2.44-5.48.913-.407zM338.47 370.93l-.808.588-3.526-4.854.81-.588zM350.652 361.015l-.743.67-4.015-4.46.743-.67zM361.705 349.878l-.67.743-4.457-4.014.67-.743zM371.507 337.65l-.587.81-4.854-3.527.587-.81zM387.106 310.478l-.407.913-5.482-2.44.407-.913zM392.643 295.846l-.31.95-5.706-1.853.31-.95zM396.676 280.646l-.208.978-5.868-1.247.208-.978zM399.076 265.163l-.104.995-5.967-.627.104-.994zM398.95 233.827l.104.994-5.967.628-.105-.994zM396.456 218.34l.208.977-5.87 1.248-.207-.978zM392.325 203.24l.31.95-5.708 1.854-.31-.95zM386.666 188.578l.406.914-5.48 2.44-.407-.913zM370.927 161.525l.588.81-4.854 3.525-.587-.81zM361.005 149.354l.67.743-4.46 4.014-.668-.742zM349.87 138.305l.744.67-4.014 4.458-.743-.67zM337.654 128.495l.81.588-3.528 4.854-.81-.588zM310.474 112.905l.913.407-2.44 5.48-.914-.406zM295.838 107.35l.95.31-1.853 5.705-.95-.31zM280.65 103.333l.978.208-1.248 5.87-.978-.208zM265.16 100.93l.996.105-.627 5.967-.996-.105z"/>
</g>
<g id="minute-hand">
<circle id="boundry" opacity=".5" fill="none" cx="249.973" cy="250" r="149.973"/>
<path fill="#3C3C3B" d="M250 107.375v138.632h-1.812l-1.938-11.757z"/>
<path d="M250.022 107.375v138.632h1.81l1.94-11.757z"/>
<circle fill="#3C3C3B" cx="249.938" cy="250.062" r="7.146"/>
<circle fill="#EDEDED" cx="249.938" cy="250.062" r="1.75"/>
</g>
<g id="hour-hand">
<circle id="boundry_3_" opacity=".5" fill="none" cx="249.973" cy="250" r="149.973"/>
<path fill="#3C3C3B" d="M250 147.378v98.63h-1.812l-1.938-11.758z"/>
<path d="M250.022 147.378v98.63h1.81l1.94-11.758z"/>
<circle fill="#3C3C3B" cx="249.938" cy="250.062" r="7.146"/>
<circle fill="#EDEDED" cx="249.938" cy="250.062" r="1.75"/>
</g>
<g id="logo">
<path d="M268.174 158.946H263.86v2h2.314v10.887h2v-10.887h2.312v-2zM271.758 171.833v-12.875l12.063 12.875v-12.875zM228.236 158.958l-5.926 9.25-5.926-9.25h-1.074v12.875h2v-7.722l5 7.806 5-7.805v7.723h2v-12.875zM244.84 158.958l-5.936 9.254-5.954-9.254h-2.378l8.334 12.954 8.31-12.954zM261.487 158.958l-5.927 9.25-5.926-9.25h-1.074v12.875h2v-7.722l5 7.806 5-7.805v7.723h2v-12.875z"/>
</g>
<g id="second-hand">
<circle id="boundry_2_" opacity=".5" fill="none" cx="249.973" cy="250" r="149.973"/>
<circle fill="#5FBBE1" cx="249.938" cy="250.062" r="4.333"/>
<path fill="#5FBBE1" d="M248.875 110.358h2.196V272h-2.195z"/>
<circle fill="#3C3C3B" cx="249.938" cy="250.062" r="1.75"/>
</g>
</svg>
body {
background-color:#a2d8db;
overflow: hidden;
text-align:center;
}
body,
html {
width:100%;
height:100%;
margin: 0;
}
svg{
position: absolute;
top: 50%;
margin: -250px 0 0 -250px;
height: 500px;
width: 500px;
}
var d = new Date(); // for now
var hours = d.getHours(); // => 9
var minutes = d.getMinutes(); // => 30
var seconds = d.getSeconds(); // => 51
var hour_hand = $( "#hour-hand" );
TweenMax.set(hour_hand, {
transformOrigin:"50%, 50%",
rotation: (hours * 30) + ((minutes * 6) / 12)
})
var minute_hand = $( "#minute-hand" );
TweenMax.set(minute_hand, {
transformOrigin:"50%, 50%",
rotation: minutes * 6
})
var second_hand = $( "#second-hand" );
var rotation = 0;
TweenMax.set(second_hand, {transformOrigin:"50%, 50%"})
setInterval(function(){
rotation += 6;
TweenMax.to(second_hand, 0.2, {
rotation: rotation
});
}, 1000);
Also see: Tab Triggers