Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--fontstyle import-->
<link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@900&family=Playfair+Display:wght@600&family=Ultra&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@469&display=swap" rel="stylesheet">

<!DOCTYPE html>
<html>
  <head>
    <title>Coronavirus Counter</title>
  <!--This is the information read by the internet on the metadata-->
  </head>
  <body>
    <div class="background">
    <header class="introduction"> 
      <!--title div-->
      <h1>Days Until V-C Day*</h1>
      <h2>Victory over Coronavirus</h2>
      </br>
    </br>
    <h3>Days (EST) until vaccine availability, based on earliest, fastest <a href="https://www.nytimes.com/interactive/2020/04/30/opinion/coronavirus-covid-vaccine.html">NYT estimates</a>*.</h3>
      </br>
  </br>
    </header> 
    
    <section class="company selector">
      <!--selector for different companies-->
      <!--not sure how to build this yet-->
    </section>
    
    <section class="jscounter">
      <!--timer countdown device-->
      <!--z is a spacer -->
      <z></z>
      <p id="day"></p>
      <h2>:</h2>
      <p id="hour"></p>
      <h2>:</h2>
      <p id="minute"></p>
      <h2>:</h2>
      <p id="second"></p>
      <z></z>
      <z></z>
      <h4>DAYS</h4>
      <z></z>
      <h4>HOURS</h4>
      <z></z>
      <h4>MINUTES</h4>
      <z></z>
      <h4>SECONDS</h4>
    </section>
   
    <section class="todaytomorrow">
      <!--today's date-->
      <div class="datetile">
      <month id="currentmonth"></month>
      <day id="currentday"></day>
      <year id="currentyear"></year>
      </div>
      <div class="datetile">
      <month id="futuremonth"></month>
      <day id="futureday"></day>
      <year id="futureyear"></year>
      </div>
      <h4>TODAY</h4>
      <h4>EXPECTED</h4>
    </section>
    
   
    <footer>
    </footer>
  </div>
  </body> 

</html>

              
            
!

CSS

              
                /*note of advice: font-family: 'Merriweather', serif;
font-family: 'Playfair Display', serif;
font-family: 'Ultra', serif;*/

html{
  /*background-color: #F5F5DC;*/
  background-image: linear-gradient(45deg,#F5F5DC, darksalmon);
  background-repeat: no-repeat;
  border-color: white;
  height:100%;
  position: relative;
}


.background{
  background-image: url(http://www.edbertcheng.com/uploads/2/2/8/5/22858004/corona5_orig.png);
  background-repeat: no-repeat;
  background-position: 50% 40%;
  background-size: 60%;
  position: relative;
}



.introduction {
  position: relative;
  padding: 5px;
  margin: auto;
  color: black;
  font-family: 'Oswald', serif;
  text-align: center;
}

.jscounter {
  position: relative;
  margin: auto;
  width: 75%;
  display:grid;
  grid-template-columns: 25px 125px 25px 125px 25px 125px 25px 125px 25px;
  grid-template-rows: 125px 25px;
  justify-content: center;
}

.todaytomorrow {
  margin: auto;
  width: 50%;
  display:grid;
  padding: 5%;
  grid-template-columns: 300px 300px;
  grid-template-rows: 90% 20%;
  text-align: center;
  justify-content: center;
}

.datetile {
  margin: auto;
  background-color: white;
  width: 70%;
  padding: 0% 0% 5% 0%;
  display: grid;
  grid-template-rows: 30% 50% 30%;
  text-align: center;
  border-radius: 15px;
}

h1 {
  font-size: 400%;
}

h2 {
  font-size: 300%;
  line-height: 30%;
  margin: auto;
}

h3 {
  font-weight: lighter;
  font-family: 'Oswald', serif;
}

h4 {
  font-size: 125%;
  text-align: center;
  margin: auto;
  font-family: 'Oswald', serif;
}

p {
  font-family: 'Oswald', serif;
  font-size: 250%;
  background-color:white;
  text-align: center;
  padding: 18% 5% 20% 5%;
  border-radius: 10%;
  margin: 5% 5% 5% 5%;
  border-style: solid;
  border-width: 3px;
}

#day {
  color: darkred;
}

month {
  font-family: 'Oswald', serif;
  font-size: 150%;
  background-color: darkred;
  padding: 5%;
  position: relative;
  text-align: center;
  justify-content: center;
  border-radius: 15px 15px 0% 0%;
  color: white;
}

day {
  font-family: 'Oswald', serif;
  font-size: 450%;
  padding: 5px 5px 10px 5px;
}

year {
  font-family: 'Oswald', serif;
  font-size: 150%;
}

a:link {
  color:darkred;
}

a:visited{
  color:darkred;
}

a:hover {
  color:black;
}
              
            
!

JS

              
                //Set the date we're counting down to
var countDown = new Date("August 1, 2021 00:00:00");
var countDownTime = countDown.getTime();

//New function
//Get convert month data into string
  var month = new Array();
  month[0] = "January";
  month[1] = "February";
  month[2] = "March";
  month[3] = "April";
  month[4] = "May";
  month[5] = "June";
  month[6] = "July";
  month[7] = "August";
  month[8] = "September";
  month[9] = "October";
  month[10] = "November";
  month[11] = "December";
  
  var todaymonth = new Date();
  var futuremonth = countDown;
  var t = month[todaymonth.getMonth()];
  var f = month[futuremonth.getMonth()];
  document.getElementById("currentmonth").innerHTML= t;
  document.getElementById("futuremonth").innerHTML= f;


//Update the count down every 1 second
var x = setInterval(function(){
  
  //Get today's date and time
  var now = new Date().getTime();
  var today = new Date();
  var tomorrow = countDown;
  var todayyear = new Date().getFullYear();
  var tomorrowyear =  countDown.getFullYear();
        
  //Find the distance between now and countdown date
  var distance = countDownTime - now;
  
  //Time calculations for days, hours, minutes and seconds
  var days = Math.floor(distance/(1000*60*60*24));
  var hours = Math.floor((distance % (1000*60*60*24))/(1000*60*60));
  var minutes = Math.floor((distance % (1000*60*60))/(1000*60));
  var seconds = Math.floor((distance % (1000*60))/1000);
  
  //Output result in an element with id="counter"
  document.getElementById("day").innerHTML = days;
  document.getElementById("hour").innerHTML = hours;
  document.getElementById("minute").innerHTML = minutes;
  document.getElementById("second").innerHTML = seconds;
  
  document.getElementById("currentday").innerHTML = today.getDate();
  document.getElementById("futureday").innerHTML = countDown.getDate();
  document.getElementById("currentyear").innerHTML = todayyear;
  document.getElementById("futureyear").innerHTML = tomorrowyear;
  
  //If the count down is over, write some text
  if (distance <0){
    clearInterval(x);
    document.getElementById("counter").innerHTML = "Victory!";
    document.getElementById("current").innerHTML = today;
  }
  
},1000);

              
            
!
999px

Console