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

              
                <div class="container">
  <div class="sky">
    <div class="sun"></div>
    <div class="stars"></div>
  </div>
  <div class="ocean"></div>
  <div class="sun-reflection"></div>
</div>
              
            
!

CSS

              
                /* Container */
.container {
  width: 600px;
  height: 400px;
  border: 5px solid lightgray;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Ocean */
.ocean {
  position: absolute;
  width: inherit;
  height: 178px;
  left: 0px;
  top: 222px;
  background: conic-gradient(
    from 90deg at 50% 125%,
    #021e34,
    #055ca7,
    #052b4c,
    #003b90,
    #00174a
  );
}

/* Sky */
.sky {
  position: absolute;
  width: inherit;
  height: 222px;
  top: 0;
  left: 0;
  background-image: linear-gradient(
    0deg,
    hsl(205deg 55% 42%) 0%,
    hsl(207deg 58% 40%) 4%,
    hsl(210deg 63% 37%) 9%,
    hsl(213deg 69% 35%) 15%,
    hsl(216deg 80% 32%) 21%,
    hsl(215deg 98% 27%) 28%,
    hsl(215deg 96% 25%) 35%,
    hsl(214deg 94% 23%) 42%,
    hsl(212deg 91% 20%) 49%,
    hsl(208deg 88% 16%) 56%,
    hsl(210deg 89% 16%) 63%,
    hsl(213deg 91% 15%) 70%,
    hsl(216deg 93% 15%) 76%,
    hsl(220deg 96% 15%) 82%,
    hsl(220deg 98% 14%) 87%,
    hsl(218deg 97% 13%) 91%,
    hsl(215deg 95% 13%) 95%,
    hsl(211deg 94% 12%) 98%,
    hsl(206deg 93% 11%) 100%
  );
}

/* Stars */
.stars {
  position: absolute;
  width: inherit;
  height: 150px;
  top: 0;
  left: 0;
}

.stars::before {
  content: "";
  position: absolute;
  width: inherit;
  height: 160px;
  top: 0;
  left: 0;
  background: radial-gradient(#fff 5%, transparent 5%);
  background-position: top left, 5px 23px;
  background-size: 15px 15px;
  border-radius: 50%;
  opacity: 0.1;
  transform: skew(20deg);
}

.stars::after {
  content: "";
  position: absolute;
  width: inherit;
  height: 130px;
  top: -30px;
  left: 10px;
  background: radial-gradient(#fff2d6 5%, transparent 5%);
  background-position: top left, 15px 15px;
  background-size: 20px 20px;
  border-radius: 50%;
  opacity: 0.1;
  transform: skew(35deg);
}

/* Sun */
.sun {
  position: absolute;
  width: 30px;
  height: 30px;
  top: 206px;
  left: 280px;
  background: radial-gradient(
    circle,
    #fff2d6 20%,
    #d89766 25%,
    transparent 55%
  );
}

/* Sun reflection */
.sun-reflection {
  position: absolute;
  width: 357px;
  height: 178px;
  top: 222px;
  left: 116px;
  background: conic-gradient(
    from 168deg at top,
    #d89766 0deg 20deg,
    #0000 21deg
  );
  -webkit-mask: linear-gradient(#0000, #000);
  mask-image: linear-gradient(#0000, #000);
}

/* Body */
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

              
            
!

JS

              
                
              
            
!
999px

Console