css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

    <meta name="viewport" content="width=device-width, initial-scale=1">
      Thick Lines: Sunrays

    <div class="sun"></div>

              // Generate a stepped gradient based on the hue difference between
// our desired colours. This gives us a list of values we send to
// the ‘box-shadow’ property of the element of our choice.

@function get-shadows(
  $initial-color, // Beginning colour
  $final-color, // Ending colour
  $step-width, // Step width
  $steps: 4 // Number of steps
) {

  // Find the average difference between steps. The initial colour
  // is the first step, so we need to divide by one fewer than
  // the number of steps.
  $hue-difference: (hue($initial-color) - hue($final-color)) / ($steps - 1);

  // List needs to be initialized outside the loop
  $shadow-list: ();

  // Generate rule for each step
  @for $i from 1 through $steps {

    // Initialize the var for what we’re going to do with our new difference
    $hue-adjustment: 0;

    // Subtract the difference if we’re going anti-clockwise on the
    // colour wheel, add it if not (CSS accepts negative values
    // for hue, which saves us from a bunch of gnarly math.) Again,
    // our first step is the initial colour; so we subtract one from
    // the index to make our first adjustment ‘zero’.
    @if $hue-difference > 0 {
      // Negate the difference to go backward
      $hue-adjustment: (abs($hue-difference) * ($i - 1)) * -1;
    } @else {
      // Add it to go forward
      $hue-adjustment: abs($hue-difference) * ($i - 1);

    // Final colour for this step
    $color: adjust-hue($initial-color, $hue-adjustment);

    // We’re stacking shadows here, so we multiply the desired width
    // of the step by the current index to get the ‘spread’ value
    // for our rule
    $spread: $step-width * $i;

    // Generate the rule for this shadow
    $shadow: 0 0 0 $spread $color;

    // Append the rule to the list and add a comma if it’s not the last one
    @if $i != $steps {
      $shadow-list: append($shadow-list, $shadow, 'comma');
    } @else {
      $shadow-list: append($shadow-list, $shadow);

  // Return the finished list for ‘box-shadow’ to consume down there
  @return $shadow-list;

* {
  margin: 0;
  padding: 0;

body {
  background-color: hsl(198, 87%, 50%);

.sun {
  background-color: hsl(57, 100%, 50%);
  border-radius: 15vh;
  box-shadow: get-shadows(
    hsl(48, 100%, 50%),
    hsl(19, 100%, 50%),
  height: 30vh;
  margin: -9vh auto 0;
  width: 30vh;

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................