change page size for print based on class of the certain element in css
<p>I work on a single page application. I want to print page with landscape or portrait orientation based on <code>class</code> of the <code>div</code>. And the hardest part: I want to use only css, no javascript.</p>

<p>For example,
I have a default size of the print</p>

<pre><code>@media print {
  @page {
    size: landscape
  }
}
</code></pre>

<p>but I want to resize it if block <code>"frame"</code> has a modificator <code>"media"</code></p>

<p>Unfortunately, that's doesn't work:</p>

<pre><code>@media print {
  @page .frame ._media {
    size: portrait
  }
}
</code></pre>