开发者

Hide div's containing Youtube while printing a webpage

开发者 https://www.devze.com 2023-03-18 05:23 出处:网络
I\'m creating a print stylesheet for a webpage which, next to text content, also contains youtube embeds in the content area (for instance).

I'm creating a print stylesheet for a webpage which, next to text content, also contains youtube embeds in the content area (for instance).

I don't want to print the youtube's, so I added display:none to the print stylesheet for these div's.

Now the div's are not printed but in the print preview they do take empty space, and thus pushing the text content beneath them.

Resulting in a lot of white space with text under this white space. Not nice. Is there a solution or trick to solve this?

Code:

<div class="bigblok_image">
<object height="325" width="400"><param name="movie" value="http://www.youtube.com/v/waVIqjB0WAU&amp;hl=nl&amp;fs=1"><param name="allowFullScreen开发者_运维百科" value="true"><param name="allowscriptaccess" value="always"><embed src="http://www.youtube.com/v/waVIqjB0WAU&amp;hl=nl&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="325" width="400">
</object>

div.bigblok_image { display: none; }


Add the following in the head section:

<link rel="stylesheet" href="print.css" media="print"/>

In print.css add the following:

#div-to-be-hidden
{
  display:none;
}
0

精彩评论

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