Border around specific rows in a table?

后端 未结 10 1575
轮回少年
轮回少年 2020-12-02 08:10

I\'m trying to design some HTML/CSS that can put a border around specific rows in a table. Yes, I know I\'m not really supposed to use tables for layout but I don\'t know en

10条回答
  •  借酒劲吻你
    2020-12-02 08:49

    I was just playing around with doing this too, and this seemed to be the best option for me:

    
    

    Note that this will prevent the use of fluid/automatic column widths, as cells will no longer align with those in other rows, but border/colour formatting still works OK. The solution is to give the TR and TDs a specified width (either px or %).

    Of course you could make the selector tr.myClass if you wanted to apply it only to certain rows. Apparently display: table doesn't work for IE 6/7, however, but there's probably other hacks (hasLayout?) that might work for those. :-(

提交回复
热议问题