how to make a whole row in a table clickable as a link?

前端 未结 26 1589
粉色の甜心
粉色の甜心 2020-11-22 14:05

I\'m using Bootstrap and the following doesn\'t work:


    
        
            Blah Blah
           


        
26条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 14:26

    You could include an anchor inside every , like so:

    
      Blah Blah
      1234567
      more text
    
    

    You could then use display:block; on the anchors to make the full row clickable.

    tr:hover { 
       background: red; 
    }
    td a { 
       display: block; 
       border: 1px solid black;
       padding: 16px; 
    }
    

    Example jsFiddle here.

    This is probably about as optimum as you're going to get it unless you resort to JavaScript.

提交回复
热议问题