Is there a way to add a font: Arial and color: White to this script?
<script>
var date = new Date();
days_change = -2;
date.setDate(date.getDate() + days_change);
const formattedDate = date.toLocaleString("en-GB", {
day: "numeric",
month: "long",
year: "numeric",
});
document.write(formattedDate);
</script>
As another solution.
You can wrap formattedDate in a <span>...</span> tag with a class. As here:
document.write("<span class='date_arial'>" + formattedDate + "</span>");
And add the desired styles to the CSS. As here:
.date_arial {
font-family: Arial, sans-serif;
color: #FFFFFF;
}
var date = new Date();
days_change = -2;
date.setDate(date.getDate() + days_change);
const formattedDate = date.toLocaleString("en-GB", {
day: "numeric",
month: "long",
year: "numeric",
});
document.write(formattedDate);
document.write("<span class='date_arial'>" + formattedDate + "</span>");
body {
background-color: green;
}
.date_arial {
font-family: Arial, sans-serif;
color: #FFFFFF;
}
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