I want to create an HTML table and I want its cells to be clickable. I have achieved that however, I can't vertically align text to middle in the cell. vertical-align:middle seems not working.
Here is my code:
<style type="text/css"> td { width: 200px; border: solid 1px green; height: 100%; text-align: center; vertical-align: middle; } td a { display: inline-block; height:100%; width:100%; } td a:hover { background-color: yellow; } </style> <table> <tbody> <tr> <td> <a href="http://www.google.com/">Cell 1<br> second line</a> </td> <td> <a href="http://www.google.com/">Cell 2</a> </td> <td> <a href="http://www.google.com/">Cell 3</a> </td> <td> <a href="http://www.google.com/">Cell 4</a> </td> </tr> </tbody> </table> Can you help me with that?
Thank you!
display:table-cell, along with your vertical-align, if your tables were wrapped in a div at least..at which case you'd have to id the div and put the relevant CSS there.display:table-cell, it makes only the text clickable. In my case, I want entire cell to be clickable.tableelement? ... If it can be done without, would that be an option?