Pen Settings



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


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


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.


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.


                <nav>Global navigation</nav>
  <h1>Fun with background gradients</h1>
  <p>Just a bit of fun while wondering about using simple and subtle CSS gradients for backgrounds...</p>
  <ul class="cards">
    <li class="card -red">
      <div class="card--image">✤</div><h2>Red</h2>
        <p>Red is the color at the long wavelength end of the visible spectrum of light, next to orange and opposite violet.</p>
    <li class="card -green">
      <div class="card--image">✦</div>
      <p>Green is the color between blue and yellow on the visible spectrum. It is evoked by light which has a dominant wavelength of roughly 495–570 nm.</p>
    <li class="card -blue">
      <div class="card--image">❖</div>
      <p>Blue is one of the three primary colours of pigments in painting and traditional colour theory, as well as in the RGB colour model. It lies between violet and green on the spectrum of visible light.</p>


                * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;

body {
  width: 100vw;
  height: 200vh;
  padding: 1rem;
  font: {
    size: 112.5%;
  color: #124;
  background: {
      radial-gradient(rgba(red, 0.3), rgba(red, 0) 40vw),
      radial-gradient(rgba(green, 0.3), rgba(green, 0) 40vw),
      radial-gradient(rgba(blue, 0.3), rgba(blue, 0) 40vw),
      radial-gradient(rgba(yellow, 0.3), rgba(yellow, 0) 40vw),
      radial-gradient(rgba(red, 0.3), rgba(red, 0) 40vw);
      -40vw 14rem,
      50% 10rem,
      60vw 14rem,
      -10vw calc(14rem + 20vw),
      30vw calc(14rem + 20vw);
    size: 80vw 80vw;
    repeat: no-repeat;

nav {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  padding: 1.5rem 1rem;
  background-color: white;
  border-top: 4px solid mix(purple, white);

header {
  max-width: 600px;
  margin: 24vh auto;

h1 {
  font: {
    size: 3.2rem;
    weight: 900;
  line-height: 1.1;
  + p {
    margin-top: 1rem;

main {
  max-width: 800px;
  margin: {
    right: auto;
    left: auto;

.cards {
  display: flex;
  flex-direction: column;
  margin: -1rem;
  list-style: none;
  @media (min-width: 600px) {
    flex-direction: row;

.card {
  flex: 1;
  margin: 1rem;
  padding: 1rem;
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 0 6rem rgba(black, 0.1);
  * {
    margin-bottom: 1rem;
.card--image {
  font-size: 6rem;
  line-height: 1;
  .card.-red & { color: mix(red, white); }
  .card.-green & { color: mix(green, white); }
  .card.-blue & { color: mix(blue, white); }