cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

              <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>
              body {
  margin: 1em;

a {
  color: DodgerBlue;
  text-decoration: none;

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

a:hover {
  background-color: DodgerBlue;
  color: White;

.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);
Loading ..................