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

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

CSS

              
                $water-color:#00b3d1;
$water-color-light:mix($water-color,white,50%);
$sun-color:#f9bb1c;
$sky-color:#f18219;
$horizon:11vmax;

@mixin pseudo($width,$height:$width,$radius:0,$background:transparent) { // creates a pseudo element and requires width, then sets the height and radius if you don't pass them
  background:$background;
  border-radius:$radius;
  content:"";
  display:block;
  height:$height;
  width:$width;
}

* {
  box-sizing:border-box;
  position:relative;
}
body {
  display:flex;
  flex-flow:row wrap;
  overflow:hidden;
}

// sun
.sun {
  @include pseudo(20vmax,$radius:50%,$background:$sun-color);
  box-shadow:
    // sun rings
    0 0 0 5vmax mix($sky-color,$sun-color,50%),
    0 0 0 10vmax mix($sky-color,$sun-color,75%),
    // "sky"
    0 0 0 100vmax $sky-color,
    20vmax 0 0 20vmax white
    ;
  margin:20vmax auto 0;
  min-height:200px;
  min-width:200px;
  // overflow:hidden; // makes the ::before clipped to the element
}

// ocean
.sun::before {
  @include pseudo(100vmax,$background:$water-color); // set this to the same as the height of the window so we'll never run out of ocean
  left:-40vmax;
  position:absolute;
  top:$horizon; // position of the ocean over the sun, controls how far the sun has "risen"
}

// refelctions/ripples
.sun::after {
  @include pseudo(10vmax,3.1vmax,3.1vmax,$background:$water-color-light); // use 10vmax so we can make longer or shorter "lines" as needed; set the radius equal to height to get a nice rounded rectangle
  box-shadow:
    -4vmax 0vmax 0 0vmax $water-color-light,
    7vmax 0vmax 0 0vmax $water-color-light,
    14vmax 0vmax 0 0vmax $water-color-light,
    15vmax 0vmax 0 0vmax $water-color-light,
    
    20vmax 3vmax 0 0vmax $water-color,
    1vmax 3vmax 0 0vmax $water-color-light,
    8vmax 3vmax 0 0vmax $water-color-light,
    13vmax 3vmax 0 0vmax $water-color-light,
    
    -2vmax 6vmax 0 0vmax $water-color,
    5vmax 6vmax 0 0vmax $water-color-light,
    12vmax 6vmax 0 0vmax $water-color-light,
    18vmax 6vmax 0 0vmax $water-color-light,
    
    14vmax 9vmax 0 0vmax $water-color,
    0vmax 9vmax 0 0vmax $water-color-light,
    7vmax 9vmax 0 0vmax $water-color-light,
    
    5vmax 12vmax 0 0vmax $water-color-light,
    12vmax 12vmax 0 0vmax $water-color-light,
    
    -1vmax 15vmax 0 0vmax $water-color,
    12vmax 15vmax 0 0vmax $water-color,
    6vmax 15vmax 0 0vmax $water-color-light,
    
    2vmax 18vmax 0 0vmax $water-color-light,
    7vmax 18vmax 0 0vmax $water-color-light,
    ;
  left:0;
  min-height:25px;
  min-width:100px;
  position:absolute;
  top:$horizon;
}
              
            
!

JS

              
                
              
            
!
999px

Console