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

              
                <main>
  <h1>HTML Buddies: <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code></h1>

  <p>
    Description (nee definition) lists are a bit of an outlier in HTML lists. Like ordered and unordered lists, they can be nested. Unlike ordered and unordered lists, they are made up of key/value pairs.
  </p>

  <p>
    They are also exposed to assistive technology differently and, depending on screen reader chosen, sometimes do not convey what they are.
  </p>

  <dl>
    <dt>NVDA:</dt>
    <dd>Announces as <q>list</q>,</dd>
    <dd>Counts both <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code> when providing the list item count,</dd>
    <dd>Skips <code>&lt;dd&gt;</code>s when navigating by list item (<kbd>I</kbd>).</dd>
    <dt>JAWS:</dt>
    <dd>Announces as <q>definition list</q>,</dd>
    <dd>Counts only <code>&lt;dt&gt;</code>s when providing the list item count,</dd>
    <dd>Skips <code>&lt;dd&gt;</code>s when navigating by list item (<kbd>I</kbd>).</dd>
    <dt>Voiceover (macOS):</dt>
    <dd>Announces as <q>description list</q>,</dd>
    <dd>Counts both <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code> when providing the list item count,</dd>
    <dt>Voiceover (iOS):</dt>
    <dd>Does not announce the presence of a list,</dd>
    <dd>Does not provide any count nor convey that the user is in a list,</dd>
    <dd>When navigating by lists, it is not recognized.</dd>
    <dt>TalkBack (Android):</dt>
    <dd>Announces as <q>list</q>,</dd>
    <dd>Counts both <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code> when providing the list item count,</dd>
    <dd>Skips <code>&lt;dd&gt;</code>s when navigating by list item.</dd>
    <dd>When focus is on a <code>&lt;dd&gt;</code>, after speaking the text it adds <q>definition</q>.</dd>
    <dt>Narrator</dt>
    <dd>Announces as <q>list</q>,</dd>
    <dd>Counts both <code>&lt;dt&gt;</code> & <code>&lt;dd&gt;</code> when providing the list item count,</dd>
    <dd>There is no option to navigate by list or list item.</dd>
  </dl>
  
  <p>
    Of course, once you start messing with CSS display properties, browsers dump all the information and pass along nothing to assistive technology. You can add it back with ARIA, but ARIA has no roles that map to the description list, so you may have to assign it a regular list role. See the links below for more information.
  </p>

  <h2>References</h2>

  <ul>
    <li>
      While not explicitly about lists, my post <a href="http://adrianroselli.com/2018/02/tables-css-display-properties-and-aria.html"><cite>Tables, CSS Display Properties, and ARIA</cite></a> demonstrates how easily you can accidentally strip the semantics of an element.
    </li>

    <li>
      If you need to add ARIA to your lists due to adding CSS display properties, you can retrofit the list function from my post <a href="http://adrianroselli.com/2018/05/functions-to-add-aria-to-tables-and-lists.html"><cite>Functions to Add ARIA to Tables and Lists</cite></a>.
    </li>

    <li>
      Scott O’Hara walks us through how screen readers announce the other list types in his post <a href="https://www.scottohara.me/blog/2018/05/26/aria-lists.html"><cite>ARIA Lists</cite></a>.
    </li>

    <li>
      This pen is for the May 2018 week 4 CodePen challenge, <a href="https://codepen.io/challenges/2018/may#cpc-dt-dd">HTML Buddies</a>.
    </li>
    
    <li>
      See <a href="http://adrianroselli.com/2018/06/codepen-html-buddies-challenge.html" target="_top">all four of my pens for this challenge</a> at my site with additional context.
    </li>
  </ul>

</main>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Lato:400,700|VT323");

body {
  background-color: #aeaf8c;
  color: #333;
  font-family: Lato, Arial, sans-serif;
  padding: 0;
  margin: 0;
  line-height: 1.5;
}

li:not(:first-of-type) {
  margin-top: 1em;
}

code {
  font-family: "VT323", "Courier New", Courier, monospace;
  font-size: 110%;
  font-weight: normal;
  font-variant-ligatures: none;
  padding: 0.05em 0.25em;
  background-color: rgba(255, 255, 255, 0.75);
  border-radius: 0.5em;
  box-decoration-break: slice;
}

main {
  display: block;
  box-sizing: border-box;
  width: 90%;
  margin: 1em auto;
  padding: 1em 2em;
  color: #000;
  background-color: rgba(255, 255, 255, 0.8);
  border: 0.07em solid rgba(0, 0, 0, 0.5);
  border-radius: 0.5em;
}

kbd {
  border: 0.07em solid #aaa;
  border-radius: 0.3em;
  box-shadow: 0.1em 0.2em 0.2em rgba(0, 0, 0, 0.25);
  background-color: #f9f9f9;
  background-image: linear-gradient(to bottom, #eee, #f9f9f9, #eee);
  padding: 0.1em 0.3em;
  font-family: Courier, "Courier New", monospace;
  font-size: 90%;
  color: #000;
  line-height: 1;
}

dt {
  font-weight: bold;
}

dd {
  text-indent: -1em;
}

dt:not(:first-of-type) {
  margin-top: 1em;
}

dd:not(:first-of-type) {
  margin-top: 0.25em;
}

              
            
!

JS

              
                
              
            
!
999px

Console