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>Block Links/Buttons in Rows</h1>

<table>
  <caption>Learn more about each author</caption>
  <thead>
    <tr>
      <th>Author</th>
      <th>Title</th>
      <th>Year</th>
      <th>ISBN-13</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/Miguel_de_Cervantes">Miguel De Cervantes</a></td>
      <td>The Ingenious Gentleman Don Quixote of La Mancha</td>
      <td>1605</td>
      <td>9783125798502</td>
    </tr>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/Gabrielle-Suzanne_de_Villeneuve">Gabrielle-Suzanne Barbot de Villeneuve</a></td>
      <td>La Belle et la Bête</td>
      <td>1740</td>
      <td>9781910880067</td>
    </tr>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/Isaac_Newton">Sir Isaac Newton</a></td>
      <td>The Method of Fluxions and Infinite Series: With Its Application to the Geometry of Curve-lines</td>
      <td>1763</td>
      <td>9781330454862</td>
    </tr>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/Mary_Shelley">Mary Shelley</a></td>
      <td>Frankenstein; or, The Modern Prometheus</td>
      <td>1818</td>
      <td>9781530278442</td>
    </tr>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/Herman_Melville">Herman Melville</a></td>
      <td>Moby-Dick; or, The Whale</td>
      <td>1851</td>
      <td>9781530697908</td>
    </tr>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/E._D._E._N._Southworth">Emma Dorothy Eliza Nevitte Southworth</a></td>
      <td>The Hidden Hand</td>
      <td>1888</td>
      <td>9780813512969</td>
    </tr>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/F._Scott_Fitzgerald">F. Scott Fitzgerald</a></td>
      <td>The Great Gatsby</td>
      <td>1925</td>
      <td>9780743273565</td>
    </tr>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/George_Orwell">George Orwell</a></td>
      <td>Nineteen Eighty-Four</td>
      <td>1948</td>
      <td>9780451524935</td>
    </tr>
    <tr>
      <td><a href="https://en.wikipedia.org/wiki/Nnedi_Okorafor">Nnedi Okorafor</a></td>
      <td>Who Fears Death</td>
      <td>2010</td>
      <td>9780756406691</td>
    </tr>
  </tbody>
</table>

<table>
  <caption>Reserve a book</caption>
  <thead>
    <tr>
      <th>Author</th>
      <th>Title</th>
      <th>Year</th>
      <th>ISBN-13</th>
      <th>Choose</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Miguel De Cervantes</td>
      <td id="book01">The Ingenious Gentleman Don Quixote of La Mancha</td>
      <td>1605</td>
      <td>9783125798502</td>
      <td><button type="button" id="btn01" aria-labelledby="btn01 book01" onclick="alert('Reserved \'' + document.getElementById('book01').innerHTML + '\'');">Reserve</button></td>
    </tr>
    <tr>
      <td>Gabrielle-Suzanne Barbot de Villeneuve</td>
      <td id="book02">La Belle et la Bête</td>
      <td>1740</td>
      <td>9781910880067</td>
      <td><button type="button" id="btn02" aria-labelledby="btn02 book02" onclick="alert('Reserved \'' + document.getElementById('book02').innerHTML + '\'');">Reserve</button></td>
    </tr>
    <tr>
      <td>Sir Isaac Newton</td>
      <td id="book03">The Method of Fluxions and Infinite Series: With Its Application to the Geometry of Curve-lines</td>
      <td>1763</td>
      <td>9781330454862</td>
      <td><button type="button" id="btn03" aria-labelledby="btn03 book03" onclick="alert('Reserved \'' + document.getElementById('book03').innerHTML + '\'');">Reserve</button></td>
    </tr>
    <tr>
      <td>Mary Shelley</td>
      <td id="book04">Frankenstein; or, The Modern Prometheus</td>
      <td>1818</td>
      <td>9781530278442</td>
      <td><button type="button" id="btn04" aria-labelledby="btn04 book04" onclick="alert('Reserved \'' + document.getElementById('book04').innerHTML + '\'');">Reserve</button></td>
    </tr>
    <tr>
      <td>Herman Melville</td>
      <td id="book05">Moby-Dick; or, The Whale</td>
      <td>1851</td>
      <td>9781530697908</td>
      <td><button type="button" id="btn05" aria-labelledby="btn05 book05" onclick="alert('Reserved \'' + document.getElementById('book05').innerHTML + '\'');">Reserve</button></td>
    </tr>
    <tr>
      <td>Emma Dorothy Eliza Nevitte Southworth</td>
      <td id="book06">The Hidden Hand</td>
      <td>1888</td>
      <td>9780813512969</td>
      <td><button type="button" id="btn06" aria-labelledby="btn06 book06" onclick="alert('Reserved \'' + document.getElementById('book06').innerHTML + '\'');">Reserve</button></td>
    </tr>
    <tr>
      <td>F. Scott Fitzgerald</td>
      <td id="book07">The Great Gatsby</td>
      <td>1925</td>
      <td>9780743273565</td>
      <td><button type="button" id="btn07" aria-labelledby="btn07 book07" onclick="alert('Reserved \'' + document.getElementById('book07').innerHTML + '\'');">Reserve</button></td>
    </tr>
    <tr>
      <td>George Orwell</td>
      <td id="book08">Nineteen Eighty-Four</td>
      <td>1948</td>
      <td>9780451524935</td>
      <td><button type="button" id="btn08" aria-labelledby="btn08 book08" onclick="alert('Reserved \'' + document.getElementById('book08').innerHTML + '\'');">Reserve</button></td>
    </tr>
    <tr>
      <td>Nnedi Okorafor</td>
      <td id="book09">Who Fears Death</td>
      <td>2010</td>
      <td>9780756406691</td>
      <td><button type="button" id="btn09" aria-labelledby="btn09 book09" onclick="alert('Reserved \'' + document.getElementById('book09').innerHTML + '\'');">Reserve</button></td>
    </tr>
  </tbody>
</table>

<p>
  Used in my blog post <cite><a href="https://adrianroselli.com/2020/02/block-links-cards-clickable-regions-etc.html">Block Links, Cards, Clickable Regions, Etc.</a></cite>.
</p>
              
            
!

CSS

              
                body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.4;
  /*   line-height: 1.5; */
  /*   letter-spacing: 0.12em; */
  /*   word-spacing: 0.16em; */
  color: #333;
  background: #efefef;
  margin: 0 1vw;
}

/* Standard Tables */

table {
  margin: 2em 0;
  border-collapse: collapse;
  border: 0.1em solid #d6d6d6;
}

caption {
  text-align: left;
  font-style: italic;
  padding: 0.25em 0.5em 0.5em 0.5em;
}

th,
td {
  padding: 0.25em 0.5em 0.25em 1em;
  vertical-align: text-top;
  text-align: left;
  text-indent: -0.5em;
}

th {
  vertical-align: bottom;
  background-color: #666;
  color: #fff;
}

tr:nth-child(even) th[scope=row] {
  background-color: #f2f2f2;
}

tr:nth-child(odd) th[scope=row] {
  background-color: #fff;
}

tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.05);
}

tr:nth-child(odd) {
  background-color: rgba(255, 255, 255, 0.05);
}

td:nth-of-type(2) {
  font-style: italic;
}

th:nth-of-type(3),
td:nth-of-type(3) {
  text-align: right;
}

td {
  position: relative;
}

td a[href]::after, td button::after {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  /* right: 0; */
  /* Remove the right bound (for LTR languages)      */
  /* and instead set a width to match the table      */
  /* which is easy here since I know the page margin */
  /* and it is a silly-wide table, so you will need  */
  /* to do your own calculation. The z-index is to   */
  /* ensure it covers the entire row as clickable.   */
  width: 98vw;
  z-index: 1;
}

td button::after {
  /* See above, except the button is to the right */
  /* so the left bound must be reset. The auto    */
  /* keyword allows it to reset for IE11 as well. */
  right: 0;
  left: auto;
}

tr:hover, tr:focus-within {
  outline: .5em solid rgba(0,0,255,.25);
}

td a[href]:hover::after, td a[href]:focus::after, td button:hover::after, td button:focus::after {
  background-color: rgba(255,255,0,.1);
}

button {
  font: inherit;
  text-align: center;
  padding: .25em .5em;
  margin: 0;
  border: .1em solid #00c;
  border-radius: .25em;
  background-color: #00c;
  color: #fff;
}

button:focus, button:hover {
  outline: none;
  color: #00c;
  background-color: #fff;
}

/* Help out IE */

tr a[href]:hover, tr a[href]:focus {
  outline: .4em solid rgba(0,0,255,.25);
  outline-offset: .25em;
}

/* Undo the IE */

tr:hover a[href]:hover, tr:hover a[href]:focus, tr:hover button:focus, tr:hover button:hover, tr:focus-within a[href]:hover, tr:focus-within a[href]:focus, tr:focus-within button:focus, tr:focus-within button:hover {
  outline: none;
}

              
            
!

JS

              
                
              
            
!
999px

Console