Reputation: 19114
I want to include the page title in the footer of every printed page, but I can't figure out how to do it. Basically, I'm expecting to have to do something like this:
@page {
@bottom-right {
content: attr(title);
}
}
But of course that doesn't work. AFAICS, I either need to set an attribute on @page
that I can reference using attr
, or I need to use some other method to refer to specific content (i.e. title
in my page). I am using the same CSS on multiple pages with different titles, so I can't just hard code it.
Upvotes: 1
Views: 4923
Reputation: 436
How about something like this:
<div id="myTitle"></div>
<script type="text/javascript">
document.getElementById("myTltle").innerHTML="The Page Title is: "+document.title;
</script>
Upvotes: 0
Reputation: 188
Since the attr() Function only works on the selected element it is not possible to get the title of the page to be used in the footer.
If you create your pages dynamically put the title directly in the footer, otherwise use javascript
Upvotes: 1