how to make a cell of table hyperlink

后端 未结 10 1473
盖世英雄少女心
盖世英雄少女心 2020-12-03 01:02

How can entire table cell be hyperlinked in html without javascript or jquery?

I tried to put href in td tag itself but its not working at least in chrome 18

10条回答
  •  一向
    一向 (楼主)
    2020-12-03 01:53

    Here is my solution:

    
       
       

    SomeText

    (LESS)

    td {
      padding: 1%;
      vertical-align: bottom;
      position:relative;
    
         a {
            height: 100%;
            display: block;
            position: absolute;
            top:0;
            bottom:0;
            right:0;
            left:0;
           }
    
         .item-container {
             /*...*/
         }
    }
    

    Like this you can still benefit from some table cell properties like vertical-align.(Tested on Chrome)

提交回复
热议问题