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

              
                <!-- Done: Add underlines back for Windows High Contrast Mode -->
<!-- To-do: Dump first two experiments -->
<!-- To-do: Use <main> as content container, re-lay-out all -->
<!-- To-do: Adjust styles to not affect nav areas, using :has() and brute force -->
<!-- To-do: Print styles, including URL expansion -->
<!-- To-do: Better :target styles -->
<!-- To-do: Standard comments on colors for faster replace (no pre-processing) -->
<!-- To-do: <small> and small-caps -->
<!-- To-do: Evaluate other generated content hints -->
<!-- To-do: Decide between PDF icon or just text hint -->
<!-- To-do: Browser testing (particularly the line weight, may have to use px) -->

<main>
  <section>
    <div>
      <h2>Default Link Styles</h2>
      <p>
        <a href="nerfherder"><img src="https://2.bp.blogspot.com/-7Cb-oJKZW1U/Tb7EWjVDRzI/AAAAAAAAAdw/Q4UBfWH4s_w/s320/HTML5_Logo_128.png" alt="HTML5 logo"></a>
        Sometimes a link is an image, like this one (probably to the right). But <a name="foo">this is an anchor</a>. <a href="#Anchor">This is a link to an anchor</a>.
      </p>
      <p>
        Sometimes a link appears with an acronym, <a href="nerfherder">like <abbr title="Not Safe for Work">NSFW</abbr></a>.
      </p>
      <p>
        Maybe the link has descenders, like in the <a href="nerfherder">quirky words &ldquo;thingamajiggery piddly</a> bits.&rdquo;
      </p>
      <p>
        Sub-script and super-script get links too, <a href="nerfherder">like H<sub>2</sub>SO<sub>4</sub> and then log<sub>n</sub></a> or <a href="nerfherder">9<sup>th</sup> and 6.022 &times; 10<sup>23</sup></a>.
      </p>
      <p>
        <a href="http://cnn.com">This link takes you off this site</a>, so I'm trying an SVG generated content icon. This is a <a href="foo.pdf">test PDF link</a>.
      </p>
    </div>
    <aside>
      <h2>Block Links</h2>
      <ul>
        <li><a href="nerfherder">like <abbr title="Not Safe for Work">NSFW</abbr></a></li>
        <li><a href="nerfherder">quirky thingamajiggery piddly bits</a></li>
        <li><a href="nerfherder">H<sub>2</sub>SO<sub>4</sub> and then log<sub>n</sub></a></li>
        <li><a href="nerfherder">9<sup>th</sup> and 6.022 &times; 10<sup>23</sup></a></li>
        <li><a href="http://cnn.com">This link takes you away from this site</a></li>
      </ul>
    </aside>
  </section>

  
  
  <section>
    <div>
      <h2>Text Shadow Link Styles (First Pass)</h2>
      <p>
        <a href="nerfherder"><img src="https://2.bp.blogspot.com/-7Cb-oJKZW1U/Tb7EWjVDRzI/AAAAAAAAAdw/Q4UBfWH4s_w/s320/HTML5_Logo_128.png" alt="HTML5 logo"></a>
        Sometimes a link is an image, like this one (probably to the right). But <a name="foo">this is an anchor</a>. <a href="#Anchor">This is a link to an anchor</a>.
      </p>
      <p>
        Sometimes a link appears with an acronym, <a href="nerfherder">like <abbr title="Not Safe for Work">NSFW</abbr></a>.
      </p>
      <p>
        Maybe the link has descenders, like in the <a href="nerfherder">quirky words &ldquo;thingamajiggery piddly</a> bits.&rdquo;
      </p>
      <p>
        Sub-script and super-script get links too, <a href="nerfherder">like H<sub>2</sub>SO<sub>4</sub> and then log<sub>n</sub></a> or <a href="nerfherder">9<sup>th</sup> and 6.022 &times; 10<sup>23</sup></a>.
      </p>
      <p>
        <a href="http://cnn.com">This link takes you off this site</a>, so I'm trying an SVG generated content icon. This is a <a href="foo.pdf">test PDF link</a>.
      </p>
    </div>
    <aside>
      <h2>Block Links</h2>
      <ul>
        <li><a href="nerfherder">like <abbr title="Not Safe for Work">NSFW</abbr></a></li>
        <li><a href="nerfherder">quirky thingamajiggery piddly bits</a></li>
        <li><a href="nerfherder">H<sub>2</sub>SO<sub>4</sub> and then log<sub>n</sub></a></li>
        <li><a href="nerfherder">9<sup>th</sup> and 6.022 &times; 10<sup>23</sup></a></li>
        <li><a href="http://cnn.com">This link takes you away from this site</a></li>
      </ul>
    </aside>
  </section>


  
  <section>
    <div>
      <h2> Simpler Text Shadow Link Styles</h2>
      <p>
        <a href="nerfherder"><img src="https://2.bp.blogspot.com/-7Cb-oJKZW1U/Tb7EWjVDRzI/AAAAAAAAAdw/Q4UBfWH4s_w/s320/HTML5_Logo_128.png" alt="HTML5 logo"></a>
        Sometimes a link is an image, like this one (probably to the right). But <a name="foo">this is an anchor</a>. <a href="#Anchor">This is a link to an anchor</a>.
      </p>
      <p>
        Sometimes a link appears with an acronym, <a href="nerfherder">like <abbr title="Not Safe for Work">NSFW</abbr></a>.
      </p>
      <p>
        Maybe the link has descenders, like in the <a href="nerfherder">quirky words &ldquo;thingamajiggery piddly</a> bits.&rdquo;
      </p>
      <p>
        Sub-script and super-script get links too, <a href="nerfherder">like H<sub>2</sub>SO<sub>4</sub> and then log<sub>n</sub></a> or <a href="nerfherder">9<sup>th</sup> and 6.022 &times; 10<sup>23</sup></a>.
      </p>
      <p>
        <a href="http://cnn.com">This link takes you off this site</a>, so I'm trying an SVG generated content icon. This is a <a href="foo.pdf">test PDF link</a>.
      </p>
    </div>
    <aside>
      <h2>Block Links</h2>
      <ul>
        <li><a href="nerfherder">like <abbr title="Not Safe for Work">NSFW</abbr></a></li>
        <li><a href="nerfherder">quirky thingamajiggery piddly bits</a></li>
        <li><a href="nerfherder">H<sub>2</sub>SO<sub>4</sub> and then log<sub>n</sub></a></li>
        <li><a href="nerfherder">9<sup>th</sup> and 6.022 &times; 10<sup>23</sup></a></li>
        <li><a href="http://cnn.com">This link takes you away from this site</a></li>
      </ul>
    </aside>
  </section>
  
  
  <p id="Anchor">
    Demo anchor to test <code>:target</code> styles.
  </p>
</main>

              
            
!

CSS

              
                /* To-Do: Remove text-shadow on select */

@import url(https://fonts.googleapis.com/css?family=Oswald);
@import url(https://fonts.googleapis.com/css?family=Merriweather:400,700,700italic,400italic);

body {
  background-color: #6D695C;
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAACVBMVEUAAAAAAAAAAACDY+nAAAAAA3RSTlMmDQBzGIDBAAAAG0lEQVR42uXIIQEAAADCMHj/0NdkQMws0HEeAqvwAUGJthrXAAAAAElFTkSuQmCC);
  font-size: 100%;
  font-family: 'Merriweather', serif;
  line-height: 1.4;
}

main, section, aside, div {
  display: block;
  box-sizing: border-box;
}

main > section {
  background-color: #fff;
  padding: .5em 1em;
  background-image: linear-gradient(to right, #fff 0, #fff 69%, #ddd 69%, #ddd);
  margin-bottom: 1em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Oswald', sans-serif;
  font-weight: 400;
}

section img {
  float: right;
}

section::after {
  content: "";
  display: block;
  clear: both;
}

section > div {
  float: left;
  width: 67%;
}

section > aside {
  float: right;
  width: 33%;
  padding: 0 0 1em 1em;
  font-family: 'Oswald', sans-serif;
}

aside h2 {
  padding: 0 .6em;
}

aside ul {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

aside a[href] {
  display: block;
  margin: 1em 0;
  padding: 0 1em;
}

sup, sub {
  font-size: 75%;
  line-height: 0;
}

abbr[title], acronym[title] {
  border-bottom: 0.1em dotted rgba(0,0,0,.3);
  cursor: help;
}

a[href] abbr[title], a[href] acronym[title] {
  cursor: inherit;
}

a[href] {
  color: #00c;
}

a[href]:hover, a[href]:focus {
  color: #c00;
}

aside a[href] {
  color: #c00;
}

aside a[href]:hover, aside a[href]:focus {
  color: #00c;
}

/* Reverse-engineered from https://eager.io/blog/smarter-link-underlines/ */

main section:nth-child(2) a[href] {
  text-decoration: none;
  text-shadow: 0.03em 0 rgb(255,255,255), -0.03em 0 rgb(255,255,255), 0 0.03em rgb(255,255,255), 0 -0.03em rgb(255,255,255), 0.06em 0 rgb(255,255,255), -0.06em 0 rgb(255,255,255), 0.09em 0 rgb(255,255,255), -0.09em 0 rgb(255,255,255), 0.12em 0 rgb(255,255,255), -0.12em 0 rgb(255,255,255), 0.15em 0 rgb(255,255,255), -0.15em 0 rgb(255,255,255);
  background-image: linear-gradient(rgb(255,255,255), rgb(255,255,255)), linear-gradient(rgb(255,255,255), rgb(255,255,255)), linear-gradient(rgb(24, 27, 67), rgb(24, 27, 67));
  background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
  background-repeat: no-repeat, no-repeat, repeat-x;
  background-position: 0% 89%, 100% 89%, 0% 89%;*/
}

main section:nth-child(2) aside a[href] {
  text-shadow: 0.03em 0 #ddd, -0.03em 0 #ddd, 0 0.03em #ddd, 0 -0.03em #ddd, 0.06em 0 #ddd, -0.06em 0 #ddd, 0.09em 0 #ddd, -0.09em 0 #ddd, 0.12em 0 #ddd, -0.12em 0 #ddd, 0.15em 0 #ddd, -0.15em 0 #ddd;
}

/* Fewer shadows, use currentColor */

main section:nth-child(3) a[href] {
  text-decoration: none;
  text-shadow: .07em 0 0 #fff, -.07em 0 0 #fff, 0 .05em 0 #fff;
  background-image: linear-gradient(to right, currentColor 0%, currentColor 100%);
  background-repeat: repeat-x;
  background-position: 0 93%;
  -webkit-background-size: 100% .07em;
  background-size: 100% .07em;
}

main section:nth-child(3) aside a[href] {
  text-shadow: .07em 0 0 #ddd, -.07em 0 0 #ddd, 0 .05em 0 #ddd;
}

main section:nth-child(3) a[href]::selection, main section:nth-child(3) aside a[href]::selection {
  text-shadow: none;
  /*background: transparent;*/
}

/* Support users of high contrast mode by restoring underlines */
@media screen and (-ms-high-contrast: active) {
  main section:nth-child(2) a[href], main section:nth-child(3) a[href] {
    text-decoration: underline;
  }
}


/* Generated content via SVG icons */

main section:nth-child(3) a[href^="http://"]::after, main section:nth-child(3) a[href^="https://"]::after {
  /*content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMC42IiBoZWlnaHQ9Ijc4LjEiIHZpZXdCb3g9IjAgMCAxMDAuNiA3OC4xIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxMDAuNjI1IDc4LjEyNSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iIzAxMDEwMSIgZD0iTTc1LjIgNjguMWgtNjV2LTQ1aDEzYzAgMCAzLjQtNC41IDEwLjktMTBINS4yYy0yLjggMC01IDIuMi01IDV2NTVjMCAyLjggMi4yIDUgNSA1aDc1YzIuOCAwIDUtMi4yIDUtNVY1NC40bC0xMCA4LjJWNjguMXpNNjcgMzMuM3YxNy44bDMzLjItMjZMNjcgMC4xdjE1LjdjLTQwLjMgMC00MC4zIDM5LjgtNDAuMyAzOS44QzM4LjEgMzYuOSA0NS4xIDMzLjMgNjcgMzMuM3oiLz48L3N2Zz4=);*/
  /*content: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/2729/href_new-win_ems.svg);*/
  content: "";
  display: inline-block;
  height: .5em;
  width: .75em;
  margin-left: .2em;
  /*border: 1px dotted #f00;*/
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/2729/href_new-win.svg);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: contain;
}

main section:nth-child(3) a[href^="http://"]::after, main section:nth-child(3) a[href^="https://"]::after, main section:nth-child(3) a[href^="http://"]::after path, main section:nth-child(3) a[href^="https://"]::after path {
  fill: #f00;
}

.SVGnewwin {
  height: .75em;
  width: auto;
  fill: #f00;
}

.SVGnewwin path {
  fill: #f00;
}

main section:nth-child(3) a[href$=".pdf"]::after {
  content: " (PDF)";
  /*display: inline-block;
  height: .75em;
  width: 1em;
  margin-left: .2em;
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/2729/pdf.svg); */
}

/* Style an anchor when it has been navigated to */

@keyframes Target {
	from { background-color: rgba(255, 242, 0, 1); }
	to { background-color: rgba(255, 242, 0, 0); }
}

@-webkit-keyframes Target {
  from { background-color: rgba(255, 242, 0, 1); }
	to { background-color: rgba(255, 242, 0, 0); }
}

:target {
  /*background-color: rgba(255, 242, 0, 1);*/
  -webkit-animation: Target 1s ease-out 1;
  animation: Target 1s ease-out 1;
}

/* Just in case I need it, since it has slightly better support than the Subject of a selector with Child combinator (E! > F) rule (none) */

a[href]:has( > img)) {
  background-image: none;
  /*border: 3px dotted #f00;*/
}

              
            
!

JS

              
                
              
            
!
999px

Console