CSS - 打印视图 - 隐藏除一个div之外的所有元素 [英] CSS - Print view - Hide all elements except one div
问题描述
我的打印样式有以下CSS:
* {
display:none;
}
#printableArea {
display:block;
}
我希望这可以隐藏所有元素,只显示printableArea,隐藏。所以,在打印视图中,我得到的是一个空白页。
我已经正确地包含在HEAD中,media =print在这个特定的样式表。 / p>
我相信我只是忽略了一些简单的东西,但是有人可以帮忙吗? :(
如果一个元素不显示,那么它的所有子元素都不会被显示设置为)。
*
匹配< html>
元素,因此整个文档都被隐藏。
您需要对自己隐藏的内容更有选择性。
I have the following CSS for my print style:
* {
display:none;
}
#printableArea {
display:block;
}
I expected this to hide ALL elements, and only show the printableArea, however EVERYTHING gets hidden. So, in print view, all I get is a blank page.
I have it included properly in the HEAD, with media="print" on this particular stylesheet.
I'm sure I'm just overlooking something simple, but can someone please help? :(
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 <html>
element, so the entire document is hidden.
You need to be more selective about what you hide.
这篇关于CSS - 打印视图 - 隐藏除一个div之外的所有元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!