0

I want a table with feint bars in one column sized width-wise to represent a value. The bars must be overlaid with clickable links. I'm struggling to get the bars to fill the height of their parent <td> elements and effectively sit underneath the <a> elements. This is the best I've got to:

tr {
  height: 100%;
}
.bar {
  position: relative;
  top: 0px;
  height: 100%;
  z-index: 10;
  background-color: #ff000030;
}

.link {
  position: relative;
  top: 0px;
  z-index: 20;
}
<table width="600px" style="background-color: #eee;">
  <tr>
    <th>Value</th>
    <th width="100%">Name and bar</th>
  </tr>
  <tr>
    <td>20</td>
    <td>
      <div width="50%" class="bar"></div>
      <a class="link" href="#">twenty</a>
    </td>
  </tr>
  <tr>
    <td>40</td>
    <td>
      <div width="100%" class="bar"></div>
      <a class="link" href="#">forty</a>
    </td>
  </tr>
  <tr>
    <td>10</td>
    <td>
      <div width="25%" class="bar"></div>
      <a class="link" href="#">ten</a>
    </td>
  </tr>
</table>

enter image description here

Bars are not currently visible. Grateful for assistance.

geotheory
  • 21,259
  • 25
  • 104
  • 184

0 Answers0