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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <h1>Different logo presenations</h1>
<p>Read an article about <a href="http://accessibilitymaker.com/accessible-high-contrast-logos/">high contrast images</a>.</p>
<h2>Option 1: High contrast logo using a white background as a part of the image file... not css</h2>
                        <img alt="" itemscope="itemscope" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/opaqueLogo.png" role="presentation" aria-hidden="true">
                        <span role="presentation" aria-hidden="true" class="sr-only">company name</span>
                    </a>
<h2>Option 2: High Contrast logo using media queries in the &ltpicture&gt element</h2>
<p>This technique uses the picture element and media queries</p>
<a href="#logo" class="logo" aria-label="Company name">
<picture>
    <source srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/blackLogo.png" media="(-ms-high-contrast: black-on-white)">
  <source srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/whiteLogo.png" media="(-ms-high-contrast: white-on-black)">
  <source srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/opaqueLogo.png" media="(-ms-high-contrast: active)">
  <img alt="company name" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/normalLogo.png" />
</picture>
</a>
<h2>Option 3: High contrast logo using css media queries</h2>
<a href="#logo" class="picture"><span class="sr-only">logo name</span></a>
<h2>Option 4: (Not recommended) Transparent logo using a white css background image</h2>
<p>This is an example to show the a css background cannot be used to apply a color behind a transparent image.</p>
<a href="#logo" class="backgroundImage"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/normalLogo.png" /></a>

              
            
!

CSS

              
                .picture:after{
  content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/normalLogo.png");
}
.backgroundImage{
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/white.PNG);
  background-color:#FFFFFF;
}
@media screen and (-ms-high-contrast: active){
  .picture:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/opaqueLogo.jpg");
  }
  .backgroundImage{
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/white.PNG);
    background-color:#FFFFFF;
}
}
@media screen and (-ms-high-contrast: black-on-white){
  .picture:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/blackLogo.png");
  }
  .backgroundImage{
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/white.PNG);
    background-color:#FFFFFF;
}
}
@media screen and (-ms-high-contrast: white-on-black){
  .picture:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/whiteLogo.png");
  }
  .backgroundImage{
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/white.PNG);
    background-color:#FFFFFF;
}
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* CSS Media Queries*/

.picture:after{
  content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/normalLogo.png");
}

@media screen and (-ms-high-contrast: active){
  .picture:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/opaqueLogo.png");
  }
}

@media screen and (-ms-high-contrast: black-on-white){
  .picture:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/blackLogo.png");
  }
}


@media screen and (-ms-high-contrast: white-on-black){
  .picture:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/whiteLogo.png");
  }
}

/* Picture element CSS to show High contrast logo in IE */

@media screen and (-ms-high-contrast: active){
  _:-ms-fullscreen, :root .logo:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/opaqueLogo.png");
  }
  _:-ms-fullscreen, :root .logo picture {
    display:none;
  }
}

@media screen and (-ms-high-contrast: black-on-white){
  _:-ms-fullscreen, :root .logo:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/blackLogo.png");
  }
  _:-ms-fullscreen, :root .logo picture {
    display:none;
  }
}

@media screen and (-ms-high-contrast: white-on-black){
  _:-ms-fullscreen, :root .logo:after{
    content: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/550792/whiteLogo.png");
  }
  _:-ms-fullscreen, :root .logo picture {
    display:none;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console