Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could add css style when printing?

See original GitHub issue

I base on Vue

      <div class="myclass">My Data.....</div>
<style lang="scss" scoped>
   .myclass {
      color: red;

But don’t work when printing.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

crabblycommented, Mar 1, 2018

You can pass [*] for all styles.

mugarcommented, Feb 24, 2018

define first your styling like <style lang="scss" scoped> .myclass { color: red; font-size: 15px; margin: 10px auto; } </style>

and in the javascript file, add in the printJS options the targetStyles property which is an array listing all the names of the css properties you have used. for the css sample above it would be like this printJS({printable: 'elementID', type:'html', targetStyles: ['color','font-size','margin'] }) so whatever css property that is not in that list of targetStyles will be ignored by printJS, but any property included in the array will be kept and used in the generation of the printable pdf.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Set Up A Print Style Sheet - Smashing Magazine
The good news is that a print style sheet is actually very easy to craft: you can follow a couple of simple CSS...
Read more >
How to Create Printer-friendly Pages with CSS - SitePoint
The DevTools ( F12 or Cmd/Ctrl + Shift + I ) can emulate print styles, although page breaks won't be shown. In Chrome,...
Read more >
CSS Printing - @media Rule - Tutorialspoint
CSS Printing - @media Rule, You can use CSS to change the appearance of your web page when it's printed on a paper....
Read more >
CSS: The Perfect Print Stylesheet | The Jotform Blog
6 – Adding Messages Before and After Printing. Sometimes, it can be very useful to be able to add messages before and after...
Read more >
Using CSS to Format Documents for Printing - MakeUseOf
In this example, the print.css stylesheet will only be used when the document is printed out. This is a very useful mechanism. We...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found