How to only show certain parts with CSS for Print?

后端 未结 6 668
悲&欢浪女
悲&欢浪女 2020-11-27 20:22

I have a page with lots of data, tables and content. I want to make a print version that will only display very few selected things.

Instead of writing another page

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 20:29

    Start here. But basically what you are thinking is the correct approach.

    Thanks, Now my question is actually becoming: How do I apply CSS to a class AND ALL OF ITS DESCENDANT ELEMENTS? So that I can apply "display:block" to whatever is in the "printable" zones.

    If an element is set to display:none; all its children will be hidden as well. But in any case. If you want a style to apply to all children of something else, you do the following:

    .printable * {
       display: block;
    }
    

    That would apply the style to all children of the "printable" zone.

提交回复
热议问题