Twitter Bootstrap: Print content of modal window

前端 未结 10 1001
走了就别回头了
走了就别回头了 2020-11-28 02:19

I\'m developing a site using Bootstrap which has 28 modal windows with information on different products. I want to be able to print the information in an open modal window.

10条回答
  •  青春惊慌失措
    2020-11-28 02:53

    I was facing two issues Issue 1: all fields were coming one after other and Issue 2 white space at the bottom of the page when used to print from popup.

    I Resolved this by

    making display none to all body * elements most of them go for visibility hidden which creates space so avoid visibility hidden

        @media print {
            body * {
               display:none;
            width:auto;
            height:auto;
            margin:0px;padding:0px; 
            }
            #printSection, #printSection * {
                display:inline-block!important;
            }
            #printSection {
                position:absolute;
                left:0;
                top:0;  
                margin:0px; 
                page-break-before: none;
                page-break-after: none;
                page-break-inside: avoid;      
            }
    #printSection .form-group{
    
          width:100%!important;
          float:left!important;
          page-break-after: avoid;
        }
    #printSection label{
            float:left!important;
            width:200px!important;
            display:inline-block!important;
          }
    
    #printSection .form-control.search-input{
            float:left!important;
            width:200px!important;
            display: inline-block!important;
          }
    }
    

提交回复
热议问题