I was appending copyright message to web page while printing, i have used following code
@media print
{
.page:after
{
content: "© 2013 Copyright message";
font-size: 14px;
position: absolute;
}
}
Is there any default way to get the current year using css?
You can attach date to the div itself (data-date
) and generate it on server side/javascript. Then in CSS you can grab it (attr(data-date)
) and attach to content. It would look like this (sorry, untested)
content: "© " attr(data-date) " Copyright message";
https://developer.mozilla.org/en-US/docs/Web/CSS/attr
http://davidwalsh.name/css-content-attr
window.onload = function()
{
document.getElementById("spanYear").innerHTML = new Date().getFullYear();
}
Copyright 1900-<span id="spanYear"></span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With