Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ 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

Auto Save

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

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

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

              
            
!

CSS

              
                // 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%),
    15vh
  );
  height: 30vh;
  margin: -9vh auto 0;
  width: 30vh;
}

              
            
!

JS

              
                
              
            
!
999px

Console