I\'m using Bootstrap and the following doesn\'t work:
Blah Blah
-
Here's an article that explains how to approach doing this in 2020: https://www.robertcooper.me/table-row-links
The article explains 3 possible solutions:
- Using JavaScript.
- Wrapping all table cells with anchorm elements.
- Using
elements instead of native HTML table elements in order to have tables rows as elements.
The article goes into depth on how to implement each solution (with links to CodePens) and also considers edge cases, such as how to approach a situation where you want to add links inside you table cells (having nested elements is not valid HTML, so you need to workaround that).
As @gameliela pointed out, it may also be worth trying to find an approach where you don't make your entire row a link, since it will simplify a lot of things. I do, however, think that it can be a good user experience to have an entire table row clickable as a link since it is convenient for the user to be able to click anywhere on a table to navigate to the corresponding page.
- 热议问题