Flood
Flood

Reputation: 345

Print.css media not fully working

I'm trying to get a few elements on my printing stylesheet to "show" at print/printpreview time and this isn't working. If I want to 'hide' elements, it works just fine.

I've tried setting the element's display=block from display=none and this isn't working. Also tried combinations thereof with using visibility=visible from visibility=hidden; no luck.

I thought I could work around this by doing some nasty hacking such as having my element at left= -3000px to left=20px; that change doesn't occur either at print time.

Another ugly hack of mine that isn't working is having the element's font color be the same as the background color in my main stylesheet, then changing it to black at print time; doesn't work either.

However, one thing that does consistently work is hiding any element at print time; so my print.css sheet does get picked up and applied.

In summary, so far, showing an element, changing its font color or position does not get picked up at print time; neither does centering an already visible element with text-align-center; by the way.

Also worth noting: The results are consistent in between IE9 and Chrome.

Any thoughts?

Upvotes: 1

Views: 5760

Answers (2)

PHLAK
PHLAK

Reputation: 22537

An ugly workaround may be to add the !important tag to the print.css style.

Example:

.element {
    display: block !important;
}

Upvotes: 1

Jason Gennaro
Jason Gennaro

Reputation: 34863

Check to see that any inline styles are not conflicting with your main css and your print styles.

Upvotes: 1

Related Questions