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

              
                <!–– Illustrations by Ryan Clark  ––!>
<svg xmlns="http://www.w3.org/2000/svg" class="ocean__fish" viewBox="0 0 365.91 430.96">
  <defs>
    <style>
      .deep-sea-cls-1{isolation:isolate}.deep-sea-cls-2,.deep-sea-cls-4{fill:#0096d5}.deep-sea-cls-2{mix-blend-mode:multiply}.deep-sea-cls-3{fill:#ec297b}.deep-sea-cls-5{fill:#eb008b}.deep-sea-cls-6{fill:#fff100}.deep-sea-cls-7{fill:#f9ec31}.deep-sea-cls-8{fill:#fff;opacity:.5;mix-blend-mode:screen}.deep-sea-cls-9{fill:#fefefe}
    </style>
  </defs>
  <circle cx="25" cy="296.6" r="12" class="deep-sea-cls-9 ocean__bubble"/>
      <circle cx="15" cy="296.6" r="8" class="deep-sea-cls-9 ocean__bubble"/>
        <circle cx="25" cy="296.6" r="10" class="deep-sea-cls-9 ocean__bubble"/>
         <circle cx="35" cy="296.6" r="8.76" class="deep-sea-cls-9 ocean__bubble"/>
        <circle cx="16" cy="296.6" r="15.25" class="deep-sea-cls-9 ocean__bubble"/>
         <circle cx="85" cy="296.6" r="35.76" class="deep-sea-cls-9 ocean__bubble"/>
        <circle cx="50" cy="296.6" r="18.68" class="deep-sea-cls-9 ocean__bubble"/>
        <circle cx="30" cy="296.6" r="24.14" class="deep-sea-cls-9 ocean__bubble"/>
  <circle cx="15" cy="290" r="19" class="deep-sea-cls-9 ocean__bubble"/>
      <path d="M27 317a24.47 24.47 0 0 0-1.61 12.51c-4.9 3-11.93 7.78-15.09 12.68l19.25 14.36L34.9 361l44.53 5.34c15.54 1.87 21-10.24 22.89-18l11.89 1.2a60.85 60.85 0 0 0 3.63 18.11 66.21 66.21 0 0 1-1.31-17.88l9.35.95a60.88 60.88 0 0 0 3.63 18.28 66.62 66.62 0 0 1-1.3-18.09l9.33.94a60.67 60.67 0 0 0 3.64 18.55 66.6 66.6 0 0 1-1.29-18.31l9.32.94a60.32 60.32 0 0 0 3.64 18.77 66.91 66.91 0 0 1-1.27-18.53l9.3.94a60.06 60.06 0 0 0 3.64 19 66.73 66.73 0 0 1-1.25-18.74l9.27.93a59.91 59.91 0 0 0 3.66 19.21 67 67 0 0 1-1.25-19l9.26.94a59.74 59.74 0 0 0 3.66 19.45 67.3 67.3 0 0 1-1.23-19.18l9.24.94a59.32 59.32 0 0 0 3.66 19.64 67.21 67.21 0 0 1-1.21-19.4l9.23.94a59.11 59.11 0 0 0 3.65 19.86 67.1 67.1 0 0 1-1.21-19.59l9.08.92c-.15 5.06.85 11.29 3.94 18.81a53 53 0 0 1-1.37-18.55l9.12.92c-.2 5.11.78 11.4 3.92 19a52.81 52.81 0 0 1-1.35-18.76l9.11.92c-.16 4.42.9 9.9 4.23 16.61a39.55 39.55 0 0 1-1.64-16.35l9.09.92c-.2 4.46.83 10 4.22 16.83a39.81 39.81 0 0 1-1.62-16.56l9.08.91c-.25 4.49.77 10.12 4.21 17a39.82 39.82 0 0 1-1.59-16.78l9.06.92c-.29 4.52.71 10.21 4.2 17.26a39.83 39.83 0 0 1-1.56-17l9 .92c-.33 4.56.65 10.32 4.19 17.48a39.87 39.87 0 0 1-1.53-17.21l2.61.26 12.57 16-4.76-15.21 3.5.36-3.49-.46 8.23-13.68-16.02 12.71-2.53-.34a34.35 34.35 0 0 1 5.29-14.1 18.12 18.12 0 0 0-7.95 13.75l-9-1.19a34.25 34.25 0 0 1 5.26-14 18.09 18.09 0 0 0-7.93 13.61l-9-1.19a34.18 34.18 0 0 1 5.24-13.82 18.09 18.09 0 0 0-7.92 13.46l-9-1.19a34.07 34.07 0 0 1 5.22-13.67 18.09 18.09 0 0 0-7.91 13.32l-9-1.19a34.16 34.16 0 0 1 5.2-13.53 18 18 0 0 0-7.89 13.17l-9-1.19a45.73 45.73 0 0 1 5.53-16.18s-6.93 4.7-8.2 15.83l-9-1.19a45.53 45.53 0 0 1 5.5-16s-6.87 4.66-8.19 15.69l-9-1.19a59.35 59.35 0 0 1 6-20s-7.53 5.88-8.62 19.61l-9-1.2a59.42 59.42 0 0 1 6-19.81s-7.49 5.84-8.62 19.46l-9-1.19a59.29 59.29 0 0 1 6-19.67s-7.44 5.8-8.61 19.32l-9-1.19a59.15 59.15 0 0 1 5.94-19.53s-7.39 5.75-8.6 19.17l-9-1.19a59.24 59.24 0 0 1 5.93-19.38s-7.33 5.71-8.58 19l-9-1.19A59 59 0 0 1 158 329.3s-7.28 5.67-8.57 18.88l-9-1.19a61.86 61.86 0 0 1 3-12.24l.15-.29a56.07 56.07 0 0 1 2.83-6.55s-7.22 5.63-8.55 18.74l-9-1.19a59.16 59.16 0 0 1 5.87-18.95s-7.16 5.59-8.53 18.6l-9-1.19a59 59 0 0 1 5.85-18.81 20.39 20.39 0 0 0-4.32 5.33l-.49 1.29h-.21a32.83 32.83 0 0 0-3.5 11.85l-11.11-1.47s3.22-21.67-19.4-24.38a67.72 67.72 0 0 0-11.71-.29 24.43 24.43 0 0 0-4.06-6.85l51.44 6.16 13.65-26.89 4.23-8.35-13.74 35.73 5.41.65L142.78 291l11-21.66-18.93 49.23 5 .59 24.64-48.54-18.93 49.22 5.07.61 13.64-26.88 4.24-8.35-13.73 35.72 14.51 1.74 30.19 6.19 10.29-17.63-7.9 18.12 7.27 1.49 8.61-14.85-6.64 15.26 7.4 1.52 6.21-10.65L220 333l6.43 1.32 4.35-7.45-3.34 7.66 86.45 17.73-.31 2.54 34.91-36-32.26 41.48.78.45 36.83-37.94L322 363.68l1.54.88 36.18-37.28-31.2 40.12 1.83 1.05 35.52-36.6-30.63 39.38 6.45 3.68-7.1 2.09L355 422.48l-25.86-44-2 .58L348 425.47l-26.34-44.78-1.69.48 21.2 47.19-26.81-45.58-.87.25L335 431l-25.4-43.19-.19 1.52-51.08-1.87 1.78 10.26-3.11-10.35-6.31-.23 2.4 13.79-4.09-13.85-7.3-.27 3.2 18.42-5.51-18.5-7.16-.26L236 408l-6.43-21.59-6-.22 4.26 24.55-7.4-24.74-7.31-.27 5.16 29.68-8.88-29.82-6.12-.22 5 28.84-8.63-29-5.08-.19 3.84 22.09-6.6-22.11-29.92-1.09-35.61-4.28a68.54 68.54 0 0 1 15.33 17.23L114.29 404a92.61 92.61 0 0 1-16-27.69l-42.86-5.15-24.36-2.96L0 346a61.85 61.85 0 0 1 27-29z" class="deep-sea-cls-2"/>
      <path d="M119.08 339.9a9.06 9.06 0 1 1-7.92-10.08 9.05 9.05 0 0 1 7.92 10.08z" class="deep-sea-cls-3"/>
      <path d="M76.49 338.23A11.92 11.92 0 1 1 66.07 325a11.92 11.92 0 0 1 10.42 13.23z" class="deep-sea-cls-4"/>
      <path d="M69.87 328.66A20.5 20.5 0 1 1 52 305.86a20.51 20.51 0 0 1 17.87 22.8z" class="deep-sea-cls-5"/>
      <path d="M61.3 315a16.67 16.67 0 0 1-31.46 5.49A20.51 20.51 0 0 1 61 309.23a16.59 16.59 0 0 1 .3 5.77z" class="deep-sea-cls-6"/>
      <path d="M59.8 327.45a10.36 10.36 0 1 1-9-11.52 10.36 10.36 0 0 1 9 11.52zM6.61 330.45s14.14 6.07 29.19 23.09l-32-19.68z" class="deep-sea-cls-4"/>
      <path d="M160.92 355.7a3 3 0 1 1-2.66-3.39 3 3 0 0 1 2.66 3.39zM167.16 365.51a3 3 0 1 1-2.66-3.39 3 3 0 0 1 2.66 3.39zM174.66 372.22a2.14 2.14 0 1 1-1.87-2.38 2.14 2.14 0 0 1 1.87 2.38zM170.4 356.51a2.14 2.14 0 1 1-1.87-2.37 2.14 2.14 0 0 1 1.87 2.37zM184 368.5a2.14 2.14 0 1 1-1.87-2.37 2.14 2.14 0 0 1 1.87 2.37z" class="deep-sea-cls-7"/>
      <path d="M173.28 350.45a2.14 2.14 0 1 1-1.87-2.38 2.14 2.14 0 0 1 1.87 2.38zM163.13 366a2.14 2.14 0 1 1-1.87-2.38 2.14 2.14 0 0 1 1.87 2.38zM185.82 370.88a2.14 2.14 0 1 1-1.82-2.38 2.14 2.14 0 0 1 1.82 2.38zM199.9 366.11a2.14 2.14 0 1 1-1.87-2.38 2.15 2.15 0 0 1 1.87 2.38zM217.7 371.57a2.14 2.14 0 1 1-1.87-2.38 2.14 2.14 0 0 1 1.87 2.38zM242.82 376.74a2.14 2.14 0 1 1-1.87-2.38 2.14 2.14 0 0 1 1.87 2.38zM230.9 367.86a2.14 2.14 0 1 1-1.87-2.38 2.14 2.14 0 0 1 1.87 2.38z" class="deep-sea-cls-3"/>
      <path d="M192.34 364a2.14 2.14 0 1 1-1.87-2.38 2.13 2.13 0 0 1 1.87 2.38zM208.42 365.94a2.14 2.14 0 1 1-1.87-2.38 2.12 2.12 0 0 1 1.87 2.38zM213 373.17a2.14 2.14 0 1 1-1.87-2.38 2.13 2.13 0 0 1 1.87 2.38zM234.65 372.43a2.14 2.14 0 1 1-1.86-2.37 2.13 2.13 0 0 1 1.86 2.37zM253 372.73a2.14 2.14 0 1 1-1.87-2.37 2.15 2.15 0 0 1 1.87 2.37zM181.07 359.59a3 3 0 1 1-2.66-3.39 3 3 0 0 1 2.66 3.39zM200.28 370.46a3 3 0 1 1-2.66-3.38 3 3 0 0 1 2.66 3.38zM224.64 364.82a3 3 0 1 1-2.66-3.39 3 3 0 0 1 2.66 3.39zM97.43 348.05A9.06 9.06 0 1 1 89.51 338a9.06 9.06 0 0 1 7.92 10.05zM147.89 347.58l-13.34 22.71h-2.08l13.72-23.38c.58.19 1.15.43 1.7.67zM141.31 345.18l-14.47 24.65q-.32 0-.63-.06-.67-.07-1.35-.18l14.64-24.92c.61.16 1.22.33 1.81.51zM134.31 343.5l-14.77 25.17-1.87-.43 14.72-25.07q.98.15 1.92.33zM126.91 342.5l-14.27 24.32c-.6-.2-1.19-.41-1.76-.62l14-23.85zM119.07 342.24l-12.89 22c-.56-.27-1.1-.56-1.62-.84l12.34-21zM159.73 360.09c-.29 2.42-2.07 4.51-4.94 6.15l4.83-8.22a6.28 6.28 0 0 1 .11 2.07zM158.88 356.08l-6.71 11.43a25.87 25.87 0 0 1-2.66.92l8.24-14a11 11 0 0 1 1.13 1.65zM153.92 350.93l-11.09 18.88c-.73.1-1.49.18-2.26.24l11.82-20.12c.54.32 1.05.66 1.53 1zM130.66 342.92L116 367.83c-.61-.17-1.22-.34-1.81-.52l14.46-24.63.77.08zM123.05 342.26l-13.7 23.35c-.58-.23-1.15-.47-1.7-.72L121 342.22c.65 0 1.35.02 2.05.04zM114.94 342.48l-11.78 20c-.53-.32-1-.66-1.52-1l11-18.8c.77-.05 1.53-.14 2.3-.2zM110.61 343.05l-10.27 17.49a16.87 16.87 0 0 1-1.34-1.25l9.24-15.75a36.6 36.6 0 0 1 2.37-.49zM106 344.14L97.82 358a10.34 10.34 0 0 1-1.11-1.71l6.59-11.22a25.22 25.22 0 0 1 2.7-.93zM156.61 353.15L147.29 369q-1.15.27-2.4.48l10.33-17.59c.5.43.97.84 1.39 1.26zM151 349.11l-12.39 21.09c-.71 0-1.43.07-2.16.08l12.91-22c.57.26 1.11.55 1.64.83zM144.66 346.29l-14 23.88c-.67 0-1.35-.09-2-.16l14.29-24.34c.55.2 1.14.4 1.71.62zM137.86 344.25l-14.72 25.09c-.65-.1-1.29-.22-1.92-.34L136 343.83zM308.51 354.66L167.3 326.87l-58.1-7.77 56.96 11.91 142.35 23.65zM311.91 362.37l18.39 10.49-18.99-8.2.6-2.29z" class="deep-sea-cls-7"/>
      <path d="M118.07 398.75s-14.36-15.56-17.91-27.58zM124.63 396.53s-14.36-15.56-17.9-27.59zM130 394.72s-10.92-11.84-13.61-21z" class="deep-sea-cls-8"/>
      <path d="M47.83 321.3a2.9 2.9 0 1 1-3.55-2.08 2.91 2.91 0 0 1 3.55 2.08z" class="deep-sea-cls-7"/>
      </g>
</svg>

              
            
!

CSS

              
                body {
  background: #CBECED;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

svg {
  height: 50vh;
  overflow: visible;
}

.ocean__bubble {
  opacity: 0;
  animation: bubble-drift 7s infinite;
}

$max-items: 10;
$delay: 1;

@for $i from 1 to $max-items {
  .ocean__bubble:nth-child(#{$i}) {
    animation-delay: $i + random(10) * 0.1 + s; // Add together nth-child iteration (eg "1") + a random number between 0 and 10. The sass random function typically chooses numbers from 1 and up, so the 0.1 multiplication math will give us what we really need. 9 * 0.1 = 0.9. 1 + 0.9 + s = 1.9s delay.
  }
}

@keyframes bubble-drift {
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: scale(0.8) translateY(-50%);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console