Hide all elements except one div for print view

前端 未结 9 2068
无人及你
无人及你 2020-12-10 10:38

I have the following CSS for my print style:

* {
 display:none;
}

#printableArea {
 display:block;
}
9条回答
  •  醉梦人生
    2020-12-10 11:03

    If an element is not displayed, then none of its children will be displayed (no matter what their display property is set to).

    * matches the element, so the entire document is hidden.

    You need to be more selective about what you hide.

提交回复
热议问题