【发布时间】:2011-06-16 13:26:27
【问题描述】:
我正在寻找一种简单的方法来隐藏除特定 div 及其内容之外的所有内容。
<html>
<head></head>
<body>
<div class="header">...</div>
<div class="menu">...</div>
<div class="content">...</div>
<div class="footer">...</div>
</body>.
</html>
例如,如果我只想打印div.content,我会这样做:
.header, .menu, .footer {
display: none;
}
如果布局复杂,就会变得凌乱。有没有更简单的方法来使用 CSS 做到这一点?
【问题讨论】:
-
按照文章可以只打印你想要的div! stackoverflow.com/questions/2255291/print-the-contents-of-a-div