在打印 CSS 中插入页面标题
我需要抓取我网站上的页面标题,然后将其插入到页面的打印版本中。当然,我有一个单独的 print.css,但是有什么方法可以获取该标题数据,也许作为使用 jQuery 的变量,然后使用 CSS 插入它,例如。 div:在{内容:“变量名称位于此处”}之前?或者有更好的方法吗?
I need to grab the page title's on my website and then insert it into the print version of the pages. I have a seperate print.css ofcourse, but is there any way I can grab that title data, maybe as a variable using jQuery, then insert it using CSS, eg. div:before {content:"variable name goes here"} ? Or is there a better approach to this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我只是在主页上有一个隐藏元素,它在打印 CSS 中获取
display:block;
。I'd just have a hidden element on your main page that gets a
display:block;
in the print CSS.当然!
我的方法会略有不同。
然后,您将拥有一个可见/不可见的
.web-hide
,具体取决于页面的打印/不打印版本。Sure!
My approach would be slightly different.
And then you would have a
.web-hide
that would be visible/not-visible depending on the print/not-print version of the page.