Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS hide table column for print

Tags:

css

html-table

I have table data and last column contains links for actions on that data. I would like that last column not visible when someone prints the page.

I tried the following and it works on screen (don't see last column, and rest of the columns are evenly spread to fill that space).

@media print {
  table td:last-child {display:none}
}

But it doesn't work for print: I don't see the column, but there is empty space where it was.

like image 344
user1588241 Avatar asked Nov 30 '12 16:11

user1588241


1 Answers

This works for me:

   @media print {
       table td:last-child {display:none}
       table th:last-child {display:none}
   }
like image 109
user2670996 Avatar answered Oct 03 '22 05:10

user2670996