Pen Settings

HTML

CSS

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

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

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.

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="bg-dark">
  <div class="content-width no-flex-container">

    <a href="#skip-link-target" id="skip-link" class="text-assistive">Skip to main content.</a>

    <div class="branding"><a href="#">Style Magic</a></div>
      <div role="navigation" aria-label="Main menu" class="menu with-branding">
        <a href="#">Home</a>
        <a href="#">CSS</a>
        <a href="#">HTML</a>
        <a href="#">JS</a>
        <a href="#">Opinion</a>
        <a href="#">Inspiration</a>
        <a href="#">Contact</a>
      </div>
  </div>
</div>

<div class="hero content-width">
  <img src="https://placeimg.com/1000/200/tech/grayscale" alt="" />
</div>

<a href="#skip-link-target" class="text-assistive display-at-top-on-focus" id="skip-link-target">Start of main content.</a>

<div role="main" class="content-width">

  <h1>Skip To Content Demo – Old Browser Support</h1>
  
  <p>An extension of the technique from our demo for our <a href="https://css-tricks.com/a-deep-dive-on-skipping-to-content/">skip to content article</a> on CSS-Tricks which demonstrates semantic markup, improved keyboard focus visibility and a skip link that works with older browsers. This technique should work for almost everyone unless you are a big fan of IE6 and below (and if you are then check out <a href="https://www.refinedpractice.com/examples/skiplink-redux-archived.html">this article from 2009</a>). It looks a little different as we've also removed other new-browser-only CSS such as <code>flex</code>, <code>rem</code> and <code>object-fit</code>.</p>

  <p>Hero image from <a href="https://placeimg.com/" >PlaceIMG</a>.</p>
  
    <p>If (like me) you are curious as to how this works on IE7 then you will need to use this <a href="http://nossl.rpress.io/skip-to-content/skip-to-content-old-browser-support.html" target="_blank">non-ssl version</a> of the demo.</p>


  <h2>Want to test with a screenreader?</h2>
  <p>If you want to test this code with a screenreader like <a href="https://www.nvaccess.org/">NVDA</a> you will find it easier to use the <a href="https://rpress.io/examples/skip-to-content/skip-to-content-old-browser-support.html" target="_blank">static version in a new tab</a>.</p>
</div>

<div class="bg-dark">
  <div class="content-width no-flex-container">
    <div role="navigation" aria-label="Utility menu" class="menu">
      <a href="#">Privacy</a>
      <a href="#">Terms &amp; Conditions</a>
    </div>
</div>
              
            
!

CSS

              
                /* Skip link styling */
.text-assistive {
  display: block;
  position: absolute;
  top: 0;
  left: -200%;
  width: 1%;
  margin: 0;
  padding: 0;
  z-index: 0;
}
.text-assistive:focus, .text-assistive:active {
  z-index: 999;
  width: 100%;
  left: 0;
  height: 80px;
  line-height: 80px;
  background: white;
  font-size: 1.2em;
  text-decoration: none;
  color: #1295e6;
  text-align: center;
}
#skip-link-target:focus {
  background: #084367;
  color: white;
}
/* end of skip link styling */

/* improved keyboard focus visibility */
a:focus, a:active {
  border-bottom-color: #1295e6;
}
.menu a:focus, .branding a:focus, .menu a:active, .branding a:active {
  background-color: white;
  color: #1295e6;
}
/* end of improved keyboard focus visibility */


/* basic styles for the rest of the page */
body {
  font-family: sans-serif;
  font-size: 20px;
  margin: 0;
  padding: 0;
}
.bg-dark {
  background: #1295e6;
  color: #fff; 
  min-height: 100px;
}
.content-width {
  max-width: 1176px;
  padding: 20px;
  margin: 0 auto;
}
a {
  text-decoration: none;
  color: #1295e6;
  border-bottom: 4px solid transparent;
}
a:hover, a:active {
  border-bottom-color: #1295e6;
}
.menu a, .branding a {
  color: white;
}
.menu a:hover, .branding a:hover {
  background-color: white;
  color: #1295e6;
}
.branding {
  display: block;
  align-items: center;
  width: 220px;
  font-size: 1.75em;
  font-style: italic;
  height: 68px;
  line-height: 68px;
  float: left;
}
.branding a {
  padding: 0 0.5em;
}
.no-flex-container {
  text-align: center;
}
.menu {
  display: block;
  height: 68px;
}
.menu a {
  display: block;
  float: left;
  height: 68px;
  line-height: 68px;
  padding: 0 1em;
}
.hero {
  width: 100%;
  height: 200px;
}
.hero img {
  width: 100%;
  height: 100%;
}
/* end of basic styles for the rest of the page */
              
            
!

JS

              
                 var target = document.getElementById('skip-link-target');
 document.getElementById('skip-link').setAttribute("onclick" , "document.getElementById('skip-link-target').focus();");
              
            
!
999px

Console