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.
<!DOCTYPE>
<html>
<head>
<link href="paisaje.css" rel="stylesheet" type="text/css" />
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js' type='text/javascript'></script>
<script type="text/javascript" src="http://cristiangartner.com/jquery.spritely-0.5.js"></script>
<script type="text/javascript" src="http://cristiangartner.com/canvas/canvas.js"></script>
<script type="text/javascript">
(function(ablue){
$(document).ready(function(){
$('#gato')
.sprite ({fps:12, no_of_frames:37})
});
})(jQuery);
</script>
</head>
<body >
<a href="http://www.CristianGartner.com">www.CristianGartner.com</a>
<div id="container" class = "paisaje-gral">
<div class="spinner"></div>
<div id="container" class="moon">
<div class="crater"></div>
<div class="crater2"></div>
<div class="crater3"></div>
<div class="crater4"></div>
<div class="crater5"></div>
<div class="crater6"></div>
<div class="crater7"></div>
</div>
<div class="humo"></div>
<div class="humo2"></div>
<div class="humo3"></div>
<div class="humo4"></div>
<div id="gato"></div>
</div>
<script>
function Particle( x, y, radius ) {
this.init( x, y, radius );
}
Particle.prototype = {
init: function( x, y, radius ) {
this.alive = true;
this.radius = radius || 10;
this.wander = 0.15;
this.theta = random( TWO_PI );
this.drag = 0.92;
this.color = '#fff';
this.x = x || 0.0;
this.y = y || 0.0;
this.vx = 0.0;
this.vy = 0.0;
},
move: function() {
this.x += this.vx;
this.y += this.vy;
this.vx *= this.drag;
this.vy *= this.drag;
this.theta += random( -0.5, 0.5 ) * this.wander;
this.vx += sin( this.theta ) * 0.1;
this.vy += cos( this.theta ) * 0.1;
this.radius *= 0.96;
this.alive = this.radius > 0.5;
},
draw: function( ctx ) {
ctx.beginPath();
ctx.arc( this.x, this.y, this.radius, 0, TWO_PI );
ctx.fillStyle = this.color;
ctx.fill();
}
};
var MAX_PARTICLES = 280;
var COLOURS = [ '#69D2E7', '#A7DBD8', '#E0E4CC', '#F38630', '#FA6900', '#FF4E50', '#F9D423' ];
var particles = [];
var pool = [];
var demo = Sketch.create({
container: document.getElementById( 'container' ),
retina: true
});
demo.setup = function() {
// Set off some initial particles.
var i, x, y;
for ( i = 0; i < 20; i++ ) {
x = ( demo.width * 0.5 ) + random( -100, 100 );
y = ( demo.height * 0.5 ) + random( -100, 100 );
demo.spawn( x, y );
}
};
demo.spawn = function( x, y ) {
if ( particles.length >= MAX_PARTICLES )
pool.push( particles.shift() );
particle = pool.length ? pool.pop() : new Particle();
particle.init( x, y, random( 5, 40 ) );
particle.wander = random( 0.5, 2.0 );
particle.color = random( COLOURS );
particle.drag = random( 0.9, 0.99 );
theta = random( TWO_PI );
force = random( 2, 8 );
particle.vx = sin( theta ) * force;
particle.vy = cos( theta ) * force;
particles.push( particle );
};
demo.update = function() {
var i, particle;
for ( i = particles.length - 1; i >= 0; i-- ) {
particle = particles[i];
if ( particle.alive ) particle.move();
else pool.push( particles.splice( i, 1 )[0] );
}
};
demo.draw = function() {
demo.globalCompositeOperation = 'lighter';
for ( var i = particles.length - 1; i >= 0; i-- ) {
particles[i].draw( demo );
}
};
demo.mousemove = function() {
var particle, theta, force, touch, max, i, j, n;
for ( i = 0, n = demo.touches.length; i < n; i++ ) {
touch = demo.touches[i], max = random( 1, 4 );
for ( j = 0; j < max; j++ ) {
demo.spawn( touch.x, touch.y );
}
}
};
</script>
</body>
<html>
.paisaje-gral
{
position: relative;
width: 800px;
height: 400px;
background-color: #000;
border-radius: 10px;
background-image: url(http://cristiangartner.com/canvas/casas.png);
overflow: hidden;
margin: 0 auto;
}
.ilustracion
{
position: absolute;
width: 800px;
height: 400px;
bottom: 0px;
margin: 0px 0px;
background-repeat: no-repeat;
background-image: url(http://cristiangartner.com/canvas/casas.png);
}
#gato
{
position: absolute;
width: 81px;
height: 41px;
background-image: url(http://cristiangartner.com/canvas/gato.png);
-webkit-animation: agato 3.08333333333333s infinite;
-moz-animation: agato 3.08333333333333s infinite;
-o-animation: agato 3.08333333333333s infinite;
-ms-animation: agato 3.08333333333333s infinite;
animation: agato 3.08333333333333s infinite;
}
@-webkit-keyframes agato {
0% {
margin: 362px 780px;
}
90% {
margin: 362px 120px;
}
100% {
margin: 262px -50px;
}}
@-moz-keyframes agato {
0% {
margin: 362px 780px;
}
90% {
margin: 362px 120px;
}
100% {
margin: 262px -50px;
}}
@-o-keyframes agato {
0% {
margin: 362px 780px;
}
90% {
margin: 362px 120px;
}
100% {
margin: 262px -50px;
}}
@-ms-keyframes agato {
0% {
margin: 362px 780px;
}
90% {
margin: 362px 120px;
}
100% {
margin: 262px -50px;
}}
@keyframes agato {
0% {
margin: 362px 780px;
}
90% {
margin: 362px 120px;
}
100% {
margin: 262px -50px;
}}
.spinner {
width: 30px;
height: 30px;
position: absolute;
top: 50%;
left: 50%;
margin-top: 48px;
margin-left: -327px;
border: 3px solid #FFFFFF;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
}
.spinner::before, .spinner::after {
content: "";
position: absolute;
display: block;
width: 3px;
background-color: #FFF5CF;
-webkit-border-radius: 1.5px;
-moz-border-radius: 1.5px;
-ms-border-radius: 1.5px;
-o-border-radius: 1.5px;
border-radius: 1.5px;
}
.spinner::before {
height: 9px;
left: 13.5px;
top: 50%;
-webkit-animation: spin 2000ms linear infinite;
-moz-animation: spin 2000ms linear infinite;
-ms-animation: spin 2000ms linear infinite;
-o-animation: spin 2000ms linear infinite;
animation: spin 2000ms linear infinite;
-webkit-transform-origin: center top;
-moz-transform-origin: center top;
-ms-transform-origin: center top;
-o-transform-origin: center top;
transform-origin: center top;
}
.spinner::after {
height: 12px;
left: 13.5px;
top: 50%;
-webkit-animation: spin 500ms linear infinite;
-moz-animation: spin 500ms linear infinite;
-ms-animation: spin 500ms linear infinite;
-o-animation: spin 500ms linear infinite;
animation: spin 500ms linear infinite;
-webkit-transform-origin: center top;
-moz-transform-origin: center top;
-ms-transform-origin: center top;
-o-transform-origin: center top;
transform-origin: center top;
}
@-webkit-keyframes spin {
to {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-moz-keyframes spin {
to {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-ms-keyframes spin {
to {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes spin {
to {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.moon{
position:absolute;
top: 7%;
right: 4%;
width: 175px;
height: 175px;
border-radius:50%;
background:#FFFF8C;
box-shadow:0px 0px 100px #FFFF8C;
z-index:5;
-webkit-animation: moonAnimation 3s infinite;
-moz-animation: moonAnimation 3s infinite;
-ms-animation: moonAnimation 3s infinite;
-o-animation: moonAnimation 3s infinite;
animation: moonAnimation 3s infinite;
}
.crater{
position:absolute;
top: 25px;
left: 30px;
width:25px;
height: 36px;
background: #E6EB77;
border-top-right-radius:50px 100px;
border-top-left-radius:50px 100px;
border-bottom-right-radius:50px 100px;
border-bottom-left-radius:50px 100px;
-webkit-transform:rotate(40deg);
-moz-transform:rotate(40deg);
-o-transform:rotate(40deg);
-ms-transform:rotate(40deg);
transform:rotate(40deg);
}
.crater2{
position:absolute;
top:125px;
right: 31px;
width: 36px;
height: 29px;
background: #E6EB77;
border-top-right-radius: 38px 43px;
border-top-left-radius: 41px 52px;
border-bottom-right-radius: 49px 53px;
border-bottom-left-radius: 62px 59px;
-webkit-transform:rotate(-60deg);
-moz-transform:rotate(-60deg);
-o-transform:rotate(-60deg);
-ms-transform:rotate(-60deg);
transform:rotate(-60deg);
}
.crater3{
position:absolute;
top:120px;
left:60px;
width:10px;
height:10px;
background: #E6EB77;
border-radius:50%;
}
.crater4{
position:absolute;
top:90px;
right:90px;
width:10px;
height:10px;
background: #E6EB77;
border-radius:50%;
}
.crater5{
position:absolute;
top:50px;
left:120px;
width:30px;
height:35px;
background: #E6EB77;
border-radius:50%;
-webkit-transform:rotate(120deg);
-moz-transform:rotate(120deg);
-o-transform:rotate(120deg);
-ms-transform:rotate(120deg);
transform:rotate(120deg);
}
.crater6{
position:absolute;
bottom:15px;
left:80px;
width:15px;
height:15px;
background: #E6EB77;
border-radius:50%;
}
.crater7{
position:absolute;
bottom:15px;
left:130px;
width:5px;
height:5px;
background: #E6EB77;
border-radius:50%;
}
@keyframes moonAnimation {
0% {
-webkit-box-shadow: 0px 0px 100px #FFFF8C;
-moz-box-shadow: 0px 0px 100px #FFFF8C;
box-shadow: 0px 0px 100px #FFFF8C;
}
50% {
-webkit-box-shadow: 0px 0px 240px #FFFF8C;
-moz-box-shadow: 0px 0px 240px #FFFF8C;
box-shadow: 0px 0px 240px #FFFF8C;
}
100% {
-webkit-box-shadow: 0px 0px 100px #FFFF8C;
-moz-box-shadow: 0px 0px 100px #FFFF8C;
box-shadow: 0px 0px 100px #FFFF8C;
}
}
@-moz-keyframes moonAnimation {
0% {
-moz-box-shadow: 0px 0px 100px #FFFF8C;
box-shadow: 0px 0px 100px #FFFF8C;
}
50% {
-moz-box-shadow: 0px 0px 240px #FFFF8C;
box-shadow: 0px 0px 240px #FFFF8C;
}
100% {
-moz-box-shadow: 0px 0px 100px #FFFF8C;
box-shadow: 0px 0px 100px #FFFF8C;
}
}
@-webkit-keyframes moonAnimation {
0% {
-webkit-box-shadow: 0px 0px 100px #FFFF8C;
box-shadow: 0px 0px 100px #FFFF8C;
}
50% {
-webkit-box-shadow: 0px 0px 240px #FFFF8C;
box-shadow: 00px 00px 240px #FFFF8C;
}
100% {
-webkit-box-shadow: 0px 0px 100px #FFFF8C;
box-shadow: 0px 0px 100px #FFFF8C;
}
}
@-ms-keyframes moonAnimation {
0% {
box-shadow: 0px 0px 100px #FFFF8C;
}
50% {
box-shadow: 0px 0px 240px #FFFF8C;
}
100% {
box-shadow: 0px 0px 100px #FFFF8C;
}
}
@-o-keyframes moonAnimation {
0% {
box-shadow: 0px 0px 100px #FFFF8C;
}
50% {
box-shadow: 0px 0px 240px #FFFF8C;
}
100% {
box-shadow: 0px 0px 100px #FFFF8C;
}
}
#container
{
display: inherit;
}
.humo {
position: absolute;
width: 32px;
height: 32px;
background:url('http://cristiangartner.com/canvas/humo.png') no-repeat;
margin:173px 152px;
background-size:100%;
-webkit-animation: ahumo 7s infinite;
-moz-animation: ahumo 7s infinite;
-o-animation: ahumo 7s infinite;
-ms-animation: ahumo 7s infinite;
animation: ahumo 7s infinite;
}
.humo2 {
position: absolute;
width: 32px;
height: 32px;
background:url('http://cristiangartner.com/canvas/humo.png') no-repeat;
margin:173px 152px;
background-size:100%;
-webkit-animation: ahumo2 3s infinite;
-moz-animation: ahumo2 3s infinite;
-o-animation: ahumo2 3s infinite;
-ms-animation: ahumo2 3s infinite;
animation: ahumo2 3s infinite;
}
.humo3 {
position: absolute;
width: 32px;
height: 32px;
background:url('http://cristiangartner.com/canvas/humo.png') no-repeat;
margin:173px 152px;
background-size:100%;
-webkit-animation: ahumo 5s infinite;
-moz-animation: ahumo 5s infinite;
-o-animation: ahumo 5s infinite;
-ms-animation: ahumo 5s infinite;
animation: ahumo 5s infinite;
}
.humo4 {
position: absolute;
width: 32px;
height: 32px;
background:url('http://cristiangartner.com/canvas/humo.png') no-repeat;
margin:173px 152px;
background-size:100%;
-webkit-animation: ahumo 2s infinite;
-moz-animation: ahumo 2s infinite;
-o-animation: ahumo 2s infinite;
-ms-animation: ahumo 2s infinite;
animation: ahumo 2s infinite;
}
@-webkit-keyframes ahumo {
0% {
margin:173px 152px; width: 32px; height: 32px;
-webkit-transform: rotate(0deg);
}
100% {
margin:-80px 227px; width: 200px; height: 200px;
-webkit-transform: rotate(120deg);opacity: 0.0;
}}
@-moz-keyframes ahumo {
0% {
margin:173px 152px; width: 32px; height: 32px;
-moz-transform: rotate(0deg);
}
100% {
margin:-80px 227px; width: 200px; height: 200px;
-moz-transform: rotate(120deg);opacity: 0.0;
}}
@-o-keyframes ahumo {
0% {
margin:173px 152px; width: 32px; height: 32px;
-o-transform: rotate(0deg);
}
100% {
margin:-80px 227px; width: 200px; height: 200px;
-o-transform: rotate(120deg);opacity: 0.0;
}}
@-ms-keyframes ahumo {
0% {
margin:173px 152px; width: 32px; height: 32px;
-ms-transform: rotate(0deg);
}
100% {
margin:-80px 227px; width: 200px; height: 200px;
-ms-transform: rotate(120deg);opacity: 0.0;
}}
@keyframes ahumo {
0% {
margin:173px 152px; width: 32px; height: 32px;
transform: rotate(0deg);
}
100% {
margin:-80px 227px; width: 200px; height: 200px;
transform: rotate(120deg);opacity: 0.0;
}}
@-webkit-keyframes ahumo2 {
0% {
margin:173px 152px; width: 20px; height: 20px;
-webkit-transform: rotate(0deg);
}
100% {
margin:-200px 157px; width: 300px; height: 300px;
-webkit-transform: rotate(-90deg);opacity: 0.0;
}}
@-moz-keyframes ahumo2 {
0% {
margin:173px 152px; width: 20px; height: 20px;
-moz-transform: rotate(0deg);
}
100% {
margin:-200px 157px; width: 300px; height: 300px;
-moz-transform: rotate(-90deg);opacity: 0.0;
}}
@-o-keyframes ahumo2 {
0% {
margin:173px 152px; width: 20px; height: 20px;
-o-transform: rotate(0deg);
}
100% {
margin:-200px 157px; width: 300px; height: 300px;
-o-transform: rotate(-90deg);opacity: 0.0;
}}
@-ms-keyframes ahumo2 {
0% {
margin:173px 152px; width: 20px; height: 20px;
-ms-transform: rotate(0deg);
}
100% {
margin:-200px 157px; width: 300px; height: 300px;
-ms-transform: rotate(-90deg);opacity: 0.0;
}}
@keyframes ahumo2 {
0% {
margin:173px 152px; width: 20px; height: 20px;
transform: rotate(0deg);
}
100% {
margin:-200px 157px; width: 300px; height: 300px;
transform: rotate(-90deg);opacity: 0.0;
}}
Also see: Tab Triggers