twitter-bootstrap 使用 bootstrap css 打印

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16498459/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 17:06:19  来源:igfitidea点击:

Printing with bootstrap css

twitter-bootstrapprinting-web-page

提问by Christian R

I have a page with bootstrap css layout. I am trying to print off a table. However the table looks nothing like it does on screen. I include the css file like this:

我有一个带有 bootstrap css 布局的页面。我正在尝试打印一张桌子。然而,该表看起来与屏幕上的完全不同。我包括这样的 css 文件:

<link href='../bootstrap.min.css' rel='stylesheet' type='text/css'>

Is there a way to get the printed table to look the same as on screen or do I have to create a specific css file just for the table I want to print?

有没有办法让打印的表格看起来与屏幕上的一样,还是我必须为我想要打印的表格创建一个特定的 css 文件?

回答by Christopher Hackett

You can apply the style sheet too both print and screen using media='screen,print'

您也可以使用打印和屏幕应用样式表 media='screen,print'

 <link ../bootstrap.min.css' rel='stylesheet' media='screen,print'>

回答by Vivek Vadoliya

Replace every col-md-with col-xs-eg: replace every col-md-6to col-xs-6.

替换每个col-md-col-xs-例如:替换每个col-md-6col-xs-6

And don't forget to use bootstrap table class.

并且不要忘记使用引导表类。

This is the thing that worked for me to get me rid of this problem you can figure out what you have to replace.

这是对我有用的东西,可以让我摆脱这个问题,你可以弄清楚你必须更换什么。

Thank you.

谢谢你。

回答by Arivan Bastos

You should use media="all"to assure your css will applied in all cases including printing. Using media='screen,print'did not work for me.

您应该使用media="all"来确保您的 css 将应用于包括打印在内的所有情况。使用media='screen,print'对我不起作用。

<link ../bootstrap.min.css' rel='stylesheet' media='all'>