I need to remove classes from different elements within the @media print
on my CSS and add those classes on the @media screen
.
Is there anyway to remove classes from the CSS file?
Something like:
@media print{ .element{/*Remove class*/} } @media screen{ .element{/*Add class*/} }
I need to remove ui-tabs-hide
added by a jQuery function (which hides the element in a weird way, as its not display:block
or display:none
) class from those elements at the time of printing and putting it back when finished printing.
In plain JavaScript, you can use the Element. classList. remove() method to remove the specific class from an element. Like jQuery's removeClass() method, this won't remove any inline styles applied to the element using the style attribute.
Use the classList. remove() method to remove a class from a div element, e.g. box. classList. remove('my-class') .
You can't remove a class in a media query… only change the properties styled within it as you state. Offhand, a shadow effect shouldn't break a menu…so either you override the styles or resort to javascript to remove the class.
No. CSS can't modify the DOM, only its presentation.
CSS can't take out elements from the HTML document, however you could try something like:
@media print{ element.relevantclass { display: none; }
This would tell the printed media to not display this element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With