如何创建可打印的 Twitter-Bootstrap 页面 [英] How to create a printable Twitter-Bootstrap page

查看:41
本文介绍了如何创建可打印的 Twitter-Bootstrap 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Twitter-Bootstrap,我需要能够按照它在浏览器上的显示方式打印页面.我可以很好地打印用 Twitter-Bootstrap 制作的其他页面,但我似乎无法打印我的页面,我的页面纯粹使用 Twitter-Bootstrap.我是否在某处丢失了标签?

I'm using Twitter-Bootstrap and I need to be able to print the page the way it looks on the browser. I'm able to print other pages made with Twitter-Bootstrap just fine but I can't seem to print my page that uses purely Twitter-Bootstrap. Am I missing a tag somewhere?

打印时的官方 TB 页面:

Official TB page when printed:

打印时我的页面:

我的页面实际上是什么样子:

What my page actually looks like:

推荐答案

请务必指定用于打印的样式表.
它可以是一个单独的样式表:

Be sure to have a stylesheet assigned for printing.
It could be a separate stylesheet:

<link rel="stylesheet" type="text/css" media="print" href="print.css">

或您为所有设备共享的一个:

or one you share for all devices:

<link rel="stylesheet" type="text/css" href="bootstrap.min.css"> # Note there's no media attribute

然后,您可以在单独的样式表或使用媒体查询的共享样式表中为打印机编写样式:

Then, you can write your styles for printers in the separate stylesheets or in the shared one using media queries:

@media print {
    /* Your styles here */
}

这篇关于如何创建可打印的 Twitter-Bootstrap 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆