Issues using external stylesheet
See original GitHub issueI use print.js to print my html page. But why the text color can’t be printed? The rest css style is no problem.
My CSS
#tax td{
color: #518cb8 !important;
}
My print.js
$(function(){
printJS({
printable: 'print-area',
type: 'html',
css: ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',
'https://fonts.googleapis.com/css?family=Open+Sans:400,700'
],
targetStyles: ['*']
});
});
My html
<table>
<tfoot>
<tr id="tax">
<td colspan="4">Tax Base</td>
<td class="text-right">5000</td>
</tr>
</tfoot>
</table>
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
html - External CSS not working
As soon as I outsourced my CSS code in an external file, the exact same problem came across. For me the problem was...
Read more >How to fix CSS not linking to your HTML document
When you add an external CSS file to your HTML document, you need to add the rel="stylesheet" attribute to the <link> tag to...
Read more >Help! My CSS Isn't Working!
Another place you might run into problems is in trying to use external stylesheets. First, using @import is risky at best, because Netscape...
Read more >text-align problem CSS: External Style Sheets, Identifying ...
In the CSS you need to have a rule for #subheader (the # is for selecting an element by its id attribute), and...
Read more >How to Fix CSS file is not Working with HTML in Chrome
Fix CSS file is not Working with HTML in Chrome | Problem Solved Show SupportBuy Me a COFFEE: https://buymeacoffee.com/Webjahin ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @conangithub,
Try passing all your css through the
css
property, and disable the library style processing.Ex.:
This will also be faster since it prevents the client / library from running some javascript code to retrieve all the applied style on your html.
Update: I was able to just make the changes directly to the file in my local repo to see if they work. The change does seem to help load the fonts internal to the application inside the iframe. Would you be able to either put together a PR with that commit or review one if I put it together, @crabbly?