【问题标题】:why selector of @media print is not displaying correct format when i click print button?为什么当我单击打印按钮时@media print 的选择器没有显示正确的格式?
【发布时间】:2015-03-08 18:46:49
【问题描述】:

当我点击打印按钮时,文本应该显示在打印对话框的四列中,但它显示为我写的段落。

This are my script code where there is click event of print button. 
when i click it print dialog popup but the text which it suppose to 
show in four column shows it as a paragraphs.

 <script>

    $(document).ready(function () {

        $(document.body).on('click', '#btnPrint', function () {
         
         
            window.print();
           
            
           
        });
    });


</script>
my css code.



@media print {
   
 .FourColumnClass
    {
    -webkit-column-count: 4; 
    -moz-column-count: 4;
    column-count: 4;

    -webkit-column-gap: 40px; 
    -moz-column-gap: 40px;
    column-gap: 40px;
    }

}
my html code.

<div class="clsbtn">
    <button type="button" id="btnPrint">Print</button>
</div>

<div class="FourColumnClass">
  my dog name is jonney. my dog name is jonney. my dog name is jonney.
  my dog name is jonney. my dog name is jonney. my dog name is jonney. 
  my dog name is jonney. my dog name is jonney. my dog name is jonney. my   dog name is jonney.
</div>

【问题讨论】:

标签: javascript jquery html css


【解决方案1】:

在您的&lt;link rel="stylesheet" type="text/css" href="mystyle.css" media="print"&gt; html 头部添加media="print"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-15
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多