Jump to content

Code block not adopting native css

Recommended Posts

I have made a code block that has a daily count up javascript in it

It works just fine however it's not bringing over the native CSS into it and I'm not sure what I'm supposed to do here at this juncture. 

Here is the code


<h1 id="andrewrox" data-behavior="daysSince">¯\_(ツ)_/¯</h1>
<h1>Consecutive days</h1>
<script>
 // To set two dates to two variables 
    var date1 = new Date("01/01/2019"); 
var date2 = new Date(); 
  
// To calculate the time difference of two dates 
var Difference_In_Time = date2.getTime() - date1.getTime(); 
  
// To calculate the no. of days between two dates 
var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24); 

//To display the final no. of days (result) 
document.querySelector('[data-behavior="daysSince"]').innerHTML = Math.round(Difference_In_Days)
  
</script>

here are the two screenshots showing the native CSS then when you preview it, there is no CSS applied1543075228_ScreenShot2019-10-11at11_02_56AM.thumb.png.13a15874de4617a0e16b18e87e9c3462.png

983589700_ScreenShot2019-10-11at11_02_34AM.thumb.png.4ab77054d7e9d6e0cac220f9078315ab.png

Link to comment
  • Replies 0
  • Views 168
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.