Bootstrap grid for printing

前端 未结 11 2219
长情又很酷
长情又很酷 2020-12-23 11:25

I would like to design a report page with a different layout for printing to mobile. I am using bootstrap v3. It seems the grid can\'t differentiate between the two as the b

11条回答
  •  独厮守ぢ
    2020-12-23 12:01

    What I did was to manually recreate those columns classes in my print css.

    .col-print-1 {width:8%;  float:left;}
    .col-print-2 {width:16%; float:left;}
    .col-print-3 {width:25%; float:left;}
    .col-print-4 {width:33%; float:left;}
    .col-print-5 {width:42%; float:left;}
    .col-print-6 {width:50%; float:left;}
    .col-print-7 {width:58%; float:left;}
    .col-print-8 {width:66%; float:left;}
    .col-print-9 {width:75%; float:left;}
    .col-print-10{width:83%; float:left;}
    .col-print-11{width:92%; float:left;}
    .col-print-12{width:100%; float:left;}
    

    Then I just use those classes like I use bootstrap classes to make my columns for print only. I also created .visible-print and .hidden-print to hide/show elements only in the print version.

    It still needs some work, but that quick patch helped me a lot.

提交回复
热议问题