no border on HTML table when printing

前端 未结 6 1867
感情败类
感情败类 2020-12-14 19:21

I\'m working on website that is supposed to print table.

One problem I\'m running into is that some table borders won\'t be printed, although they are correctly disp

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 19:56

    Following up on the comment by "K D" it looks like you're not copying the CSS over to the new window. My guess is that you're doing it this way so only that specific table on the entire page is printed. There is an easier way to go about this, define a print stylesheet which negates every element except the one you want to print. No JavaScript and new windows and copying anything over is needed.

    
    

    myPrintStylesheet.css:

    * {
        display: none;
    }
    
    #table {
        display: block;
    }
    

提交回复
热议问题