Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

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.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <p>He creado una versión mejorada usando<br> React para cargar otras formas. La pudes veren Github</p>

<p><a target="blank" href="https://manumorante.com/css.learn">Versión en GitHub → </a></p>

<hr>

<h3>Click on Next to start :)</h3>
<!-- HTML -->
<div class="heart">
<div class="heart-body"></div>
</div>

<!--
CSS steps
Write your CSS in steps. Try it!:
-->
<ol id="cssteps">
<li>
 .heart {
   width: 300px;
   height: 300px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  background: gray;
}
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  background: gray;
}
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  transform: rotate(225deg);
  background: tomato;
}
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  transform: rotate(225deg);
  background: tomato;
}
.heart-body:after {
  position: absolute;
  left: 0;
  content: '';
  width: 100%;
  height: 100%;
  background-color: gray;
}
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  transform: rotate(225deg);
  background: tomato;
}
.heart-body:after {
  position: absolute;
  left: 100%;
  content: '';
  width: 100%;
  height: 100%;
  background-color: gray;
}
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  transform: rotate(225deg);
  background: tomato;
}
.heart-body:after {
  position: absolute;
  left: 100%;
  content: '';
  width: 100%;
  height: 100%;
  background-color: gray;
  border-radius: 50%;
}
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  transform: rotate(225deg);
  background: tomato;
}
.heart-body:after {
  position: absolute;
  left: 50%;
  content: '';
  width: 100%;
  height: 100%;
  background-color: gray;
  border-radius: 50%;
}
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  transform: rotate(225deg);
  background: tomato;
}
.heart-body:before,
.heart-body:after {
  position: absolute;
  left: 50%;
  content: '';
  width: 100%;
  height: 100%;
  background-color: gray;
  border-radius: 50%;
}
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  transform: rotate(225deg);
  background: tomato;
}
.heart-body:before,
.heart-body:after {
  position: absolute;
  content: '';
  width: 100%;
  height: 100%;
  background-color: gray;
  border-radius: 50%;
}
.heart-body:before { top: 50%; }
.heart-body:after { left: 50%; }
</li>
<li>
 .heart {
   width: 300px;
   height: 300px;
   margin: 200px;
 }
.heart-body {
  width: 50%;
  height: 50%;
  transform: rotate(225deg);
  background: tomato;
}
.heart-body:before,
.heart-body:after {
  position: absolute;
  content: '';
  width: 100%;
  height: 100%;
  background-color: inherit;
  border-radius: 50%;
}
.heart-body:before { top: 50%; }
.heart-body:after { left: 50%; }
</li>
</ol>
              
            
!

CSS

              
                /*
  Your css should be written in HTML box.
  Divided into steps in #cssteps list.
*/

// Animating.... :-)
*, *:after, *:before { transition: all .4s; }

// ###############################
// You don't need edit this
$steps: 15 !default;
$code-width: 310px;
$code-margin: 15px;

$gray: #ddd;

#cssteps{
	*{ box-sizing: border-box; }
	position: absolute;
  top: $code-margin*2;
	bottom: $code-margin;
	right: $code-margin;
	width: $code-width;
	padding: 0;
	
	li{
		display: none;
		width: 100%;		
		height: 100%;
		padding: 10px;
		border: 1px solid $gray;
    background-color: #333;
		color: #fff;
		white-space: pre-wrap;
		font-family: 'Courier New';
    font-size: 14px;
    outline: none;
    overflow: auto;
	}
	
	@for $i from 1 through $steps{		
		&.step#{$i} li:nth-child(#{$i}) { display: block; }
	}	
}

.current-step{
	position: absolute;
	top: $code-margin;
	right: $code-width + $code-margin;
	width: 20px;
	height: 20px;
	text-align: center;
	font-family: arial;
	font-size: 15px;
	line-height: 20px;	
	color: white;
	background-color: black;
}
.controls{
	position: absolute;
	top: $code-margin;
  right: $code-margin;
  width: $code-width;
  
  button{
    border: 1px solid $gray;
    width: 50%;
    height: $code-margin*2;
    outline:0;
    cursor: pointer;
    background: $gray;
    font-size: 14px;
    color: darken($gray, 30%);
    
    &:hover{
      background: lighten($gray, 5%);
    }
  }
}

body {
	font-family: arial
}
              
            
!

JS

              
                // Rock!
$(document).ready(function() {
  console.clear();
	var step = 1,
			$steps = 	$('#cssteps'),
      $steps_list = $('li', $steps),
			steps = $steps_list.length;
  
  $steps_list.attr('contenteditable','true');
	
	var rockUpdate = function() {
    var $li = $('li:nth-child('+ step +')', $steps);
		$('#style-tag').html($li.html());
		$steps.removeClass().addClass('step'+step);
		$('.current-step').html(step);
    //$li.focus();
	};
	
	var html =
			// Tag styls
			'<style id="style-tag"></style>'+
			
			// Step indicator
			'<div class="current-step">1</div>'+
			
			// Controls
			'<aside class="controls"><button class="back">Back</button><button class="next">Next</button></aside>';
	
	$("body").append(html);
	var $next = $('.controls .next');
	var $back = $('.controls .back');
	
	$next.on('click', function(){
		if(++step > steps) step = 1;
		rockUpdate();
	});
	
	$back.on('click', function(){
		if(--step < 1) step = steps;
		rockUpdate();
	});
	
	rockUpdate();
	
	$('body').keyup(function(){ rockUpdate(); });
	
});
              
            
!
999px

Console