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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

HTML

            
              <h1>Artificially passing Success Criterion 1.4.12 Text Spacing</h1>

Currently, the success criterion sets certain values for line height, letter spacing etc. as a lowest boundary. This leaves out any potential values that fall between the base value and the low boundary. The below block has been limited to a particular height, and <code>overflow:hidden</code> has been added, meaning that once text metrics change, text may become cut off...but to pass the normative wording of the success criterion, there's extra scripting in the page which removes the specific cut-off styling, but only when the lower bound threshold (just checking line height in this example) is reached or exceeded.</p>
<pre><code>if ((parseInt(styles.getPropertyValue('line-height')) / parseInt(styles.getPropertyValue('font-size'))) >= 1.5) { ... }</code></pre>

<div id="limiter">
  <p>In content implemented using markup languages that support the following text style properties, no loss of content or functionality occurs by setting all of the following and by changing no other style property:</p>
  <ul>
    <li>Line height (line spacing) to at least 1.5 times the font size;</li>
    <li>Spacing following paragraphs to at least 2 times the font size;</li>
    <li>Letter spacing (tracking) to at least 0.12 times the font size;</li>
    <li>Word spacing to at least 0.16 times the font size.</li>
  </ul>
  <p>Exception: Human languages and scripts that do not make use of one or more of these text style properties in written text can conform using only the properties that exist for that combination of language and script.</p>
</div>
<p>This can be tested with something like the <a href="https://codepen.io/stevef/full/YLMqbo">text spacing bookmarklet</a> ... load the page, and then run the bookmarklet, which forces the exact minimum boundary values defined normatively in the success criterion. You'll briefly see how the content of the box gets cut off, until the scripting kicks in at the next second and adds the class that removes the problem again and passes the SC. The key here is that if the bookmarklet were to set <code>line-height</code> not to <code>1.5</code>, but to any other lower value, the script will <strong>not</strong> kick in and text will be cut-off...but that won't fail the normative wording.</p>
<p>How common would this approach be? Admittedly, this is contrived...but in my long years of web development and WCAG auditing, I've seen worse attempts at "passing" WCAG criteria in some kind of artificial way.</p>
<p>See the related <a href="https://github.com/w3c/wcag/issues/635">WCAG 2.1 issue on GitHub</a></p>
            
          
!

CSS

            
              body { font-size: 1em; line-height: 1; font-family: Helvetica, Arial, sans-serif; }
#limiter { width: 25em; height: 20em; overflow: hidden; border: 1px black solid; padding: 0.5em; }
#limiter.low-vision-pass { height: auto; overflow: auto; }
            
          
!

JS

            
              function wcagpasser() {
  var styles = window.getComputedStyle(document.querySelector('h1'));
  var limiter = document.querySelector('#limiter');
  /* check if line height was set to 1.5 of font size or higher */
  if ((parseInt(styles.getPropertyValue('line-height')) / parseInt(styles.getPropertyValue('font-size'))) >= 1.5) {
    limiter.classList.add('low-vision-pass');
  } else {
    limiter.classList.remove('low-vision-pass')
  }
}

/* run the passer once */
wcagpasser();
/* then poll every second */
window.setInterval(wcagpasser, 1000)
            
          
!
999px

Console