Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8126199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:04:36+00:00 2026-06-06T07:04:36+00:00

The following CSS affects whether a page prints in portrait or landscape by default.

  • 0

The following CSS affects whether a page prints in portrait or landscape by default.

@page {
   size: landscape;
}

I realize that this only works on a very limited set of browsers, and that the user can override it. That’s okay; I’m just trying to provide a good default.

This works fine as a static value in CSS, but I’d like to switch dynamically between portrait & landscape based on on user choices. Is it possible to use JavaScript to change this value?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:04:38+00:00Added an answer on June 6, 2026 at 7:04 am

    One simple way is to create a separate style for @page and change it:

    var cssPagedMedia = (function () {
        var style = document.createElement('style');
        document.head.appendChild(style);
        return function (rule) {
            style.innerHTML = rule;
        };
    }());
    
    cssPagedMedia.size = function (size) {
        cssPagedMedia('@page {size: ' + size + '}');
    };
    
    cssPagedMedia.size('landscape');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As far as I can tell this only affects IE 8. Using the following
The following CSS works well under firefox but doesn't work under IE browser, Why?
I have the following css: .btn_container { cursor: pointer; font-family: Tahoma,Verdana,Arial; font-size: 11px; padding:
I have the following css code h1, h2, h3, h4 { color: #333; font-size:
I have the following CSS on my HTML page: <style type=text/css> .hidden {display:none;} .visible
If i have the following CSS: .contactUsDiv label, input { display:block; } Does that
How do create a styleClass for the following CSS? I want it only to
The following CSS works fine in Internet Explorer filer:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr= 'white' , EndColorStr= 'gainsboro'
The following CSS works in Firefox, Chrome and Safari. But for some reason IE
The following css works perfectly in firefox but not IE(7). Why? In IE 7

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.