How to make print use desktop media queries?

前端 未结 3 1201
难免孤独
难免孤独 2021-01-28 12:24

I am attempting to add some print functionality to my page, but I am having an issue where when I print, it is printing as if it is mobile. How can I make it so that when someon

相关标签:
3条回答
  • 2021-01-28 12:57

    You can add an @media print rule at the bottom of your stylesheet:

    @media print {
      .visible-desktop {
        display:block;
      }
      .visible-mobile {
        display:none;
      }
    }
    
    0 讨论(0)
  • 2021-01-28 13:09
    only screen
    

    This excludes print. If you want to include print, don't write that.

    0 讨论(0)
  • 2021-01-28 13:12

    You should pick one state (probably desktop) and make it the "default", by moving that state outside media queries.

    The other states should override the default state's properties in media queries.

    0 讨论(0)
提交回复
热议问题