123

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.

            
              <dl id="moons">
  <dt><a href="#titan">Titan</a>
<dd id="titan"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/titan.jpg" alt="Titan"><p>Saturn's largest moon is unique in several respects: it is the only known satellite in the solar system to have a dense atmosphere (one primarily composed of nitrogen), and the only known to have lakes on its surface (as it is far too cold to support liquid water, these bodies are liquid methane).<p>Titan was discovered in 1655 by the Dutch astronomer Christiaan Huygens. Today, the moon is considered by many scientists to be a possible habitat for non-terrestrial life. Its atmosphere is similar to that of the early Earth, and the potential of an "underground sea" of liquid water, along with tantalizing chemical imbalances in the atmosphere and crust, suggest that simple life may be present, operating in a methane, rather than water-based, environment.
<dt>
  <a href="#iapetus">Iapetus</a>
<dd id="iapetus">
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/iapetus.jpg" alt="Iapetus">
  <p>Iapetus, the third largest moon of Saturn, is fascinating both tonally and morphologically: its stretched shape and equatorial ridge cause it to resemble nothing so much as a walnut, while the extreme difference in albedo between one hemisphere and the other bring to mind an Oreo cookie. It also has a significant crater, Turgis, that is nearly 40% of the moon's diameter, with a rim scarp that towers 15 kilometres high.
<dt>
  <a href="#mimas">Mimas</a>
<dd id="mimas">
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/mimas.jpg" alt="Mimas">
  <p>Mimas was discovered by William Hershel, the same year as <a href="#enceladus">Enceladus</a>. The most remarkable feature of Mimas is its massive primary impact crater, which from certain angles causes the moon to look very much like the Death Star. The crater, named after its discoverer, is over 130 kilometres across: if a crater of equivalent scale was formed on Earth, it would be wider than Canada.<p>Mimas is also remarkable for the fact that it is the smallest object in the solar system to have formed into a sphere under the influence of its own self-gravitation.
<dt>
  <a href="#enceladus">Enceladus</a><dd id="enceladus">
  <img alt="Enceladus" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/enceladus.jpg">
  <p>Discovered by Fredrick William Herschel in 1789, tiny Enceladus is one of only four known bodies in the outer solar system with active volcanoes, the other three being the moons of <a href="http://en.wikipedia.org/wiki/Io_moon">Io</a>, <a href="http://en.wikipedia.org/wiki/Triton_moon">Triton</a> and possibly <a href="https://en.wikipedia.org/wiki/Titan_(moon)">Titan</a>. In the case of Enceladus, these are cryovolcanoes: eruptions of water, nitrogen and ammonia, rather than molten rock.<p>Just 500 kilometres in diameter, Enceladus is far too small to generate its own heat. Instead, its geological activity is mostly likely caused by its orbit around Saturn, with the gas giant constantly pulling and squeezing on the small satellite, warming the interior of the moon.<p>As a source of water, Enceladus is conjectured to harbour life, while also being the wellspring for the ice crystal content of Saturn's <a href="http://en.wikipedia.org/wiki/Rings_of_Saturn#E_Ring">E ring</a>.
</dl>
            
          
!
            
              $bgcolor: #222;
* {
  box-sizing: border-box;
}
body {
  margin: 3rem;
  background: $bgcolor;
  @media all and (max-width: 850px) {
    margin: 0;
  }
}
dl#moons { 
  line-height: 1.5;
  font-family: Avenir, sans-serif;
  position: relative;
  width: 50rem;
  @media all and (max-width: 850px) {
    width: 100%;
  }
  dt { 
    display: inline-block; 
    margin-right: .5rem;
    @media all and (max-width: 550px) {
    margin-right: 0;
     width: 25%;
  }
    position: relative;
    z-index: 5;
     a { 
       text-decoration: none; 
       color: #fff; 
       padding: 1rem;
       @media all and (max-width: 550px) {
    padding: .5rem;
  }
       border: 1px solid black;
       background: #555;
       display: block;
       min-width: 8rem;
       font-weight: 600;
       border-radius: 10px 10px 0 0;
    &:hover, &:focus { 
      background: #222;
    }
    &:visited {
       background: #aaa;
     }
    .active { 
        background: #222;
    }
  }
}
dd { 
  position: absolute; 
  left: 0; 
  margin-left: 0;
  top: 0;
  padding: 2rem 1rem 1rem 1rem;
  border-top: 3.6rem solid $bgcolor;
  @media all and (max-width: 550px) {
   border-top-width: 2rem; 
  }
  width: 100%;
  background: #000;
  color: white;
  opacity: 0;
  transition: .3s opacity;
  a { 
    color: white;
  }
  img { 
    max-width: 100%; 
    float: right; 
    margin: 1rem;
    shape-outside: circle();
    }
  }
}
dd#titan:target, dd#iapetus:target, dd#enceladus:target,dd#mimas:target { 
  z-index: 4; 
  opacity: 1;
} 
            
          
!
            
              document.querySelector('a[href="#titan"]').click();
            
          
!
999px
🕑 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.

Console