开发者

Print.css media not fully working

开发者 https://www.devze.com 2023-03-15 12:52 出处:网络
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'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 backgrou开发者_JS百科nd 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?


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


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

Example:

.element {
    display: block !important;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消