在页面中隐藏 div 并使其仅在打印引导程序 3 MVC 5 上可见 [英] Hide a div in a page and make it visible only on print bootstrap 3 MVC 5
问题描述
有一个网页向用户显示信息.如果用户决定打印它,我希望包含屏幕上不需要但在打印时会有所帮助的其他信息.
为了实现这种行为,我试图使 div
仅在打印时可见.但它没有奏效:
我正在使用 Bootstrap 3,想知道是否有一种简单的方法可以实现这一点?
解决方案 我认为你已经使用过的事实
hidden-lg hidden-md hidden-sm hidden-xs
跨越 div 意味着你已经有效地将它隐藏在所有视口中.要简单地隐藏或显示用于打印的 div,请使用以下内容:
<div class="hidden-print">非打印内容</div><div class="visible-print">仅用于打印的内容</div>
There is a web page showing information to the user. If the user decides to print it I want to include additional information that is not required on the screen, but would be helpful when printed.
In order to implement this behaviour I was trying to make a div
visible only for printing. It hasn't worked though:
<div class="visible-print hidden-lg hidden-md hidden-sm hidden-xs">
I'm using Bootstrap 3 and wondered if there is an easy way to accomplish this?
解决方案 I think the fact you've used
hidden-lg hidden-md hidden-sm hidden-xs
across the div means you've effectively hidden it across all viewports. To simply hide or show a div for print use the following:
<div class="hidden-print">content for non print</div>
<div class="visible-print">content for print only</div>
这篇关于在页面中隐藏 div 并使其仅在打印引导程序 3 MVC 5 上可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文
相关文章
- 元素仅在打印页面上可见;
- 仅在打印时显示div;
- 使用引导程序 3 打印页面;
- 无法在引导程序3上居中div;
- 如何在移动设备上隐藏 div 但使用 jQuery 使其可见;
- 使用引导程序3打印页面;
- 隐藏的DOM元素包含消息并使其可见;
- 引导程序3仅在移动设备上打破了行;
- 引导3模板更改mvc5;
- 在打印预览中隐藏TabContainer.;
- Angular 7 在打字稿中隐藏引导模式;
- 仅在打印上使用DOM操作;
- 在打印时在特定页面的底部创建一个 div;
- jQuery事件处理程序:div变为可见/隐藏;
- Div的可见性在mvc;
- 如何使用C#在MVC3中使div可见和不可见;
- Div在默认页面中不可见;
- 仅在小型设备上添加行 - 引导程序;
- 如何在页面中打印div并使用一个ASP按钮调用代码隐藏;
- 如何使单个div的内容在打印时填满整个页面;
- html @MEDIA 打印{},隐藏标记在打印中留下空白;
- 隐藏正在打印的网络网址;
- 在引导程序中禁用@media打印?;
- 在打印CSS上的每个页面周围绘制边框?;
- waterMark在打印文档上;
其他开发最新文章
- 拒绝显示一个框架,因为它将'X-Frame-Options'设置为'sameorigin';
- 什么是&QUOT; AW&QUOT;在部分标志属性是什么意思?;
- 在运行npm install命令时获取'npm WARN弃用'警告;
- cmake无法找到openssl;
- 从Spark的scala中的* .tar.gz压缩文件中读取HDF5文件;
- Twitter :: Error :: Forbidden - 无法验证您的凭据;
- 我什么时候需要一个fb:app_id或者fb:admins?;
- 将.db文件导入R;
- npm通知创建一个lockfile作为package-lock.json。你应该提交这个文件;
- 拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“script-src'self'”;