Printing with bootstrap css

给你一囗甜甜゛ 提交于 2020-01-23 06:32:14

问题


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:

<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?


回答1:


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

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



回答2:


Replace every col-md- with col-xs- eg: replace every col-md-6 to col-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.




回答3:


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.

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


来源:https://stackoverflow.com/questions/16498459/printing-with-bootstrap-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!