lesscss 打印样式
我想使用 lesscss 进行打印, 但浏览器似乎无法识别@media print
,
因为我不想嵌入
<link rel="stylesheet/css" type="text/css" href="themes/css/print.css" media="print">
到页面中。
有人可以帮忙解决这个问题吗? lesscss源代码地址在这里
谢谢
I want using lesscss for print,
but it seems, the browser don't recongize the @media print
,
since I don't want embbed
<link rel="stylesheet/css" type="text/css" href="themes/css/print.css" media="print">
into page.
can anyone help on this issue? lesscss sourse code address is here
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
重要的部分是 media="all",否则它将无法正确解析链接的 less 文件中的 @media print {.no-print {display:none;}} 。
The important part is the media="all", otherwise it will not correctly parse your @media print {.no-print {display:none;}} inside your linked less file.
如果您的问题是如何嵌入较少样式的媒体打印:链接标记中的媒体属性对我有用。
media="print"
是必不可少的,因为默认情况下 less 会将编译样式插入为media="screen"
。If your question is how to embed less-styles for media print: the media attribute within the link tag worked for me.
The
media="print"
is essential as less by default inserts compiled styles asmedia="screen"
.当我使用 .less 时,用于显示打印样式的 Web 开发人员工具选项无法为我呈现。
我的解决方案,虽然根据浏览器的不同可能无法 100% 正确呈现,但在样式表,以便在页面加载时呈现打印样式。
如果出现以下情况,我不建议使用此解决方案:
如果出现以下情况,我建议使用此解决方案:
调整
While I was using .less, the web developer tool option for displaying print styles wasn't rendering for me.
My solution, although may not render 100% correctly depending on the browser, is to switch the @media print and @media screen properties in the style sheet so that on page load, the print styles are rendered.
I don't suggest this solution if:
I do suggest this solution if:
adjustment
如果您使用 lesscss,请在“less”文件中使用 @media 属性。
像这样:
并正常导入文件:
http://lesscss.org/#-pattern -匹配和保护表达式
If you are using lesscss, use @media property into "less" file.
Like this:
And import file normaly:
http://lesscss.org/#-pattern-matching-and-guard-expressions