lundi 20 novembre 2017

Override CSS media for a tag

I'm coding a little web browser utility to generate highlighted code, and I'm making it display a preview of what it looks like with my website's stylesheet applied to it. My problem is I would like it to make it display both a "screen" and a "print" preview. Since it's a web-based utility, it naturally uses the stylesheet's "screen" media rules. So I would like it to display the code in a different tag, using the stylesheet's "print" media rules.

My question is: Is there a way to make a specific tag, like a div, use the stylesheet's print media rules even if it's a webpage being displayed in a browser? Is there a way to instruct the browser to override the actual media and pretend it's a print media for a given tag? Thank you.




Aucun commentaire:

Enregistrer un commentaire