【问题标题】:Add Page number using Page Property of CSS for each printed pages from asp.net c#使用CSS的页面属性为asp.net c#中的每个打印页面添加页码
【发布时间】:2015-04-28 16:16:11
【问题描述】:

我正在尝试从我的网站打印 33 页,但我需要使用 css 为每个打印页面添加页码我看到了很多解决方案,例如 How to print page number using cssget printed page number of an elementPage numbers with CSS/HTML 但对我没有任何作用,它在@bottom-right 中返回一个错误,即“不是已知的 CSS 属性名称”

我的 CSS :

  <style type="text/css" >
    @media print
    {
      table.break {page-break-after: left}
    .no-print, .no-print *
   {
      display: none; 
     }
     }

  @page {
      @bottom-right {
     content: counter(page) " of " counter(pages);
    }
   }
   </style>

【问题讨论】:

    标签: c# html css asp.net


    【解决方案1】:

    对我来说,您遇到的错误似乎是验证错误。 尽管所有主要浏览器都支持,但 CSS 2.1 规范中缺少一些组件。

    您可以尝试将样式表验证更改为 CSS3。

    如果你用的是VS,那么

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\1033\schemas\CSS\css30.xml
    

    是你可以开始的地方。

    【讨论】:

    • 这可能会有所帮助:stackoverflow.com/questions/3931801/…
    • 我安装了它,但启用了样式表的下拉列表
    • 不明白下拉部分的意思。正如链接引用的那样,“如果看不到它,请右键单击菜单并检查样式表。”
    • 我找到了,我选择 css3 put 仍然返回相同的错误
    • 返回此错误 (Validation(CSS 2.1): 'bottom-right' is not a known CSS property name
    【解决方案2】:

    你需要以某种方式增加页面,看看你已经发布的例子:

    counter-increment: page;
        counter-reset: page 1;
    

    使用纯示例,尝试它们是否有效,然后尝试适应您的需求。

    Further reading

    你从哪里得到这个错误?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-12
      • 2014-08-13
      • 1970-01-01
      • 1970-01-01
      • 2018-03-27
      • 2011-05-06
      相关资源
      最近更新 更多