css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

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.

              <h1>Content Group</h1>
<p>How to wrap an image, link, and text as one large touch target, while using progressively enhanced, valid HTML and keeping things fully accessible.</p>

<article class="article-teaser js-content-group" data-url="https://google.com" data-title="Google">  
  <img src="http://placehold.it/200x150" width="200" height="150" alt=""/>  
    <a href="https://google.com">Google</a>
  <p>Search the internet for things.</p>  

<article class="article-teaser js-content-group" data-url="https://apple.com" data-title="Apple">  
  <img src="http://placehold.it/200x150" width="200" height="150" alt=""/>  
    <a href="https://apple.com">Apple</a>
  <p>This one points to the Apple homepage.</p>  

<article class="article-teaser js-content-group" data-url="http://a11yproject.com" data-title="A11Y Project">  
  <img src="http://placehold.it/200x150" width="200" height="150" alt=""/>  
    <a href="http://a11yproject.com">A11YProject</a>
  <p>One more for testing purposes.</p>  

  <li>The idea behind this is to minimize the amount of tab presses required by keyboard users to navigate through content.</li>
  <li>Inspired after watching this video from Nomensa: <a href="http://www.nomensa.com/blog/2014/tips-on-combining-image-and-text-links/">Tips on combining image and text links</a>.</li>
  <li>This concept is also a <a href="http://www.w3.org/TR/2014/NOTE-WCAG20-TECHS-20140311/H2">WCAG 2.0 technique requirement</a>.</li>
  <li>Tested with NVDA+Firefox, ChromeVox, and VoiceOver+Chrome.</li>
  <li><a href="https://codepen.io/svinkle/pen/GfumK">jQuery version</a>.</li>
              a {
  text-decoration: none;

.article-teaser {
  border: solid LightGray 1px;
  display: inline-block;
  margin: 0 1em 1em 0;
  max-width: 10em;

.article-teaser img {
  height: auto;
  max-width: 100%;
.article-teaser h2 {
  padding: 0 .5em;
.article-teaser p {
  padding: 0 1em;

.clickable {
  cursor: pointer;
              (function (document, window, undefined) {
  'use strict';
  // Vars
  var contentGroup = document.querySelectorAll('.js-content-group');
  // For each
  [].forEach.call(contentGroup, function(group, index) {
    // Vars
    var link = group.querySelector('a'),
        title = group.querySelector('h2'),
        text = group.querySelector('p');
    // Set attributes
    link.setAttribute('tabindex', '-1');    
    title.setAttribute('id', 'group-title-' + index);    
    text.setAttribute('id', 'group-text-' + index);
    text.setAttribute('aria-hidden', 'true');
    // Group "button" attibutes
    group.setAttribute('tabindex', '0');
    group.setAttribute('role', 'link');
    group.setAttribute('aria-labelledby', 'group-title-' + index);
    group.setAttribute('aria-describedby', 'group-text-' + index);
    // Click event
    group.addEventListener('click', function () {
      window.location.href = this.getAttribute('data-url');      
    }, false);
    // Keydown event
    group.addEventListener('keydown', function (event) {
      if (event.which === 13) {
        window.location.href = this.getAttribute('data-url');      
    }, false);
})(document, window);
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................