使用CSS打印网页时打印页码 [英] print page numbers while printing webpage using css

查看:1375
本文介绍了使用CSS打印网页时打印页码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页.我想打印该页面,页面编号在右下角.
我想使用CSS做到这一点.我该怎么办.

I am having a web page. i want to print that page, with page numbers in bottom right position.
I want to do that using CSS. how can i do that.

<style type="text/css" media="print">
@page {
  @bottom-right {
    content: counter(page) " of " counter(pages);
  }
}
</style>



我已经使用上述CSS来实现功能.但是我失败了.



I have used the above css to achieve the functionality. But i failed.

推荐答案

您不能使用CSS设置这样的值,它不是一种编程语言.使用JavaScript来应用变量,并使用CSS格式化它们.
You can''t set values like this with CSS, it is not a programming language. Use JavaScript to apply the variables and CSS to format them.


这篇关于使用CSS打印网页时打印页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆