Jump to content

Change font colour, size in HTML code for auto-updating date

Recommended Posts

Hi there, 

I am looking to make this date bigger and also white (I have a dark background on my site). 

I have no idea how to code and pulled this from another squarespace forum. It's perfect aside from the small black text. 

<div id="dateContainer">
    <!-- Date will be displayed here -->
</div>
<script>
    const dateContainer = document.getElementById('dateContainer');
    const currentDate = new Date();
    const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
    const formattedDate = currentDate.toLocaleDateString(undefined, options);
    dateContainer.textContent = formattedDate;
</script>

 

Thank you in advance!! 

Link to comment
  • Replies 3
  • Views 734
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.