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.

  <h1>BBC News sometimes uses a widget with a list where each bullet is 'connected' by a line. This is how it works.</h1>

      So, the line to the left..
      is created using a <code>:before</code> pseudo-element on each <code>&lt;li&gt;</code>..
      with no content, 2 pixels wide, red background color, and..
      positioned absolutely relative to the list item.
      And the bullets are created using an <code>::after</code> pseudo-element on each <code>&lt;li&gt;</code>, with SVGs as <code>background-image</code>s.
  <a href="">@saadatm</a><br>
  (adapted from the <a href="">original</a> by <a href="">@peterc</a>)
              /* Some basic defaults */
  font-family: "Helvetica Neue", helvetica, sans-serif;
  font-size: 16px;

main {
  max-width: 640px;
  color: #222;

h1 { font-weight: 400; }

/* No normal bullets please */
ul {
  list-style-type: none;

li {
  /* You need to turn on relative positioning so the line is placed relative to the item rather than absolutely on the page */
  position: relative;
  /* Use padding to space things out rather than margins as the line would get broken up otherwise */
  margin: 0;
  padding-bottom: 1em;
  padding-left: 20px;

/* The actual line being placed before each list item, tweak width and color as appropriate */
li:before {
  background-color: #c00;
  width: 2px;
  content: '';
  position: absolute;
  top: 0px;
  bottom: 0px;
  left: 5px;

/* Small bullets for normal list items */
li::after {
  content: '';
  position: absolute;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='' aria-hidden='true' viewBox='0 0 32 32' focusable='false'%3E%3Ccircle stroke='none' fill='%23c00' cx='16' cy='16' r='10'%3E%3C/circle%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  left: 0;
  top: 2px;
  width: 12px;
  height: 12px;

/* Large bullet for the first list item */
li:first-child::after {
  content: '';
  width: 16px;
  height: 16px;
  left: -2px;
  top: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='' aria-hidden='true' viewBox='0 0 32 32' focusable='false'%3E%3Cpath d='M16 4c6.6 0 12 5.4 12 12s-5.4 12-12 12S4 22.6 4 16 9.4 4 16 4zm0-4C7.2 0 0 7.2 0 16s7.2 16 16 16 16-7.2 16-16S24.8 0 16 0z' fill='%23c00'%3E%3C/path%3E%3Ccircle fill='%23c00' cx='16' cy='16' r='6'%3E%3C/circle%3E%3C/svg%3E");
/* Start the line further down on the first list item */
li:first-child:before { top: 15px;  }

/* Stop the line short on the final list item */
li:last-child:before { height: 6px; }
a { color: #06e; }
🕑 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.