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 includes JSX processing.

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

Packages

Add Packages

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.

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

              
                 <section class="flex">
<!-- Insertamos solo un div para poner el corazon mediante una clase jeje -->
    <div class="heart"></div>
<!-- V 1.2 inserte un dinosaurio  -->
    <div class="dino dino-animation"></div>
    <p><a href="https://twitter.com/StonksCompany" target="black">Sigueme en Twitter</a></p>
    </section>
              
            
!

CSS

              
                /* Aqui creamos el corazon y colocamos las medidas del primer elemento del sprite */
.heart {
    background-image: url('https://stonks.company/assets/heart.png');
    cursor: pointer;
    height: 100px;
    width: 100px;
  }
  
/* Aqui creamos la animacion, el tiempo que durara, los frames que contiene -1, la cantidad de veces que se repetira y que quede el ultimo frame a la vista al finalizar */
  .heart-animation {
    animation: heart-beat .8s steps(28) 1 forwards;  
  }
  
/*Le decimos a los frames que se muevan de izquierda a derecha*/
  @keyframes heart-beat {
   from { background-position: left; }
   to { background-position: right; }
  }
  
  /*V 1.02 Dino*/
  .dino {
    background-image: url('https://stonks.company/assets/Dino.png');
    width: 24px;
    height: 24px;
  }
  
  .dino-animation {
    animation: dinorun 2s steps(23) infinite;
  }
  
  @keyframes dinorun {
   from { background-position: left; }
   to { background-position: right; }
  }

  .flex {
    display: flex;
    align-items: baseline;
  }

  .flex a {
    color: black;
    margin-left: 10px;
    text-decoration: none;
  }

  .flex a:hover {
      text-decoration: underline;
  }
              
            
!

JS

              
                /*Traemos la clase .heart para manipularla*/
const heart = document.querySelector('.heart')

/*Agregamos el escucha de eventos para registrar los clicks, que le añada la clase heart-animation al primer click, pero se lo removemos al segundo click*/
heart.addEventListener('click', () => heart.classList.toggle('heart-animation'))
              
            
!
999px

Console