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

              
                <!-- HEADER -->
  <h1></h1>
    <h2>
      <span><a href="" class="prevMonth">&laquo;</a></span>
      <a href="">Today</a>
      <span><a href="" class="nextMonth">&raquo;</a></span>
     </h2>
 
 
<div class="container">
<!-- CALENDAR -->
  <div class="calendar">
    <ul class="week">
      <li>
        <abbr title="S">Sunday</abbr>
      </li>
      <li>
        <abbr title="M">Monday</abbr>
      </li>
      <li>
        <abbr title="T">Tuesday</abbr>
      </li>
      <li>
        <abbr title="W">Wednesday</abbr>
      </li>
      <li>
        <abbr title="T">Thursday</abbr>
      </li>
      <li>
        <abbr title="F">Friday</abbr>
      </li>
      <li>
        <abbr title="S">Saturday</abbr>
      </li>
    </ul>

    <ul class="days">
    </ul>

  </div>
</div>
              
            
!

CSS

              
                body {
  font:  1em 'Montserrat', sans-serif;
  background-color: #DDE2E3;
  color: #3C455C;
}

a, a:link, a:active, a:visited {
  color: #60412B;
  text-decoration: none;
}

a:hover {
  color: #B37C57;
}

/* * * * * HEADER * * * * */
h1 {
  text-align: center;
  margin: 0;
  padding: 0;
  font: 300 2em 'Oswald', sans-serif;
  color: #3C455C;
}

/* * * * * CONTAINER * * * * */
.container {
  display: flex;
  justify-content: space-evenly;
  align-items: stretch;
  width: 100%;
}

/* * * * * NAVIGATION * * * * */
.nav {
  background-color: #9AACB8;
  width: 20%;
  padding: 10px;
  box-sizing: border-box;
  font: 300 1em 'Oswald', sans-serif;
}

h2 {
  text-align: center;
  margin: 0 auto;
  padding: 0;
  font: 300 1.2em 'Oswald', sans-serif;
}

h2 a, h2 a:link, h2 a:visited, h2 a:active {
  color: #3C455C;
  text-decoration: none;
}

h2 a:hover {
  color: #B37C57;
}

.prevMonth, .nextMonth {
  margin-left: 5px;
  margin-right: 5px;
}

/* * * * * CALENDAR * * * * */
.calendar {
  width: 90%;
  box-sizing: border-box;
}

.calendar ul {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-gap: .75em;
  margin: 0 auto;
  padding: 0;
}

.calendar .week li {
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  margin-left: 0;
}

.calendar .days li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  list-style: none;
  margin-left: 0;
}

.calendar ul.week {
  margin-bottom: 0;
}

.calendar ul.week li {
  height: 4vw;
}

.calendar ul.days li {
  background-color: #9AACB8;
  border: 1px solid #9AACB8;
  min-height: 125px;
  padding: 6px;
}

.calendar ul.days li.empty {
  background-color: transparent;
  border: 0;
}

.calendar ul.week abbr[title] {
  border: none;
  font-weight: 800;
  text-decoration: none;
}

.date {
  font-weight: 700;
}

/* * * * * CALENDAR * * * * */
.calendar .meal {
  font-size: .70em;
  display: inline-block;
  align-self: stretch;
  color: #60412B;
}

.calendar .single {
  background-color: #DDE2E3;
  color: #60412B;
  margin: 10px 0 0 0;
  padding: 2px 5px;
  border-radius: 6px; 
  -webkit-border-radius: 6px; 
  -moz-border-radius: 6px; 
  box-shadow: 5px 5px 5px -3px #777;
  -webkit-box-shadow: 5px 5px 5px -3px #777;
  -moz-box-shadow: 5px 5px 5px -3px #777;
}

.calendar .meal:empty {
  display:none;
}

/* * * * * SMALLER SCREENS * * * * */
  
@media all and (max-width: 900px) {
  .calendar ul {
    grid-gap: .25em;
  }
  
  .calendar ul.week li {
    font-size: 0;
  }
  
  .calendar ul.week > li abbr:after {
    content: attr(title);
    font-size: calc(16px + (26 - 16) * ((100vw - 300px) / (1600 - 300)));
    text-align: center;
    }
  
  .container {
    flex-direction: column-reverse;
    justify-content: center;
    align-items: center;
  }
  
  .nav {
    background-color: #9AACB8;
    width: 90%;
    padding: 10px;
    box-sizing: border-box;
    margin-top: 15px;
  }

  .calendar {
    width: 90%;
    box-sizing: border-box;
  }
  
  .calendar .meal {
    font-size: .70em;
    align-self: stretch;
    color: #60412B;
  }
  
  .calendar .single {
    background-color: #DDE2E3;
    color: #60412B;
     white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 10px 0 0 0;
    padding: 2px 5px;
    width: 2vw;
    height: 2vh;
    border-radius: 6px; 
    -webkit-border-radius: 6px; 
    -moz-border-radius: 6px; 
    box-shadow: 5px 5px 5px -3px #777;
    -webkit-box-shadow: 5px 5px 5px -3px #777;
    -moz-box-shadow: 5px 5px 5px -3px #777;
  }
}
              
            
!

JS

              
                let currentDate = new Date();
let currentDay = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
let currentMonth = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

class Calendar {
  constructor(){
    this.month = currentDate.getMonth();
    this.year = currentDate.getFullYear();
  }
  
  clearCalendar(){
    document.querySelector("h1").innerHTML = "";
    document.querySelector(".days").innerHTML = "";
  }
  
  monthHeader() {
    document.querySelector("h1").innerHTML = `${currentMonth[this.month]}, ${this.year}`;
  }
  
  generateDays(){
    let firstDay = new Date(this.year, this.month, 1); //call the 1st of the current month
    let firstFallsOn = firstDay.getDay(); //Which day of the week the 1st falls on: Sun-Sat, 0-6 
    for (let n = 0; n < firstFallsOn; n++) {
      document.querySelector(".days").innerHTML += `<li class="empty"></li>`;
    }
    this.numberOfDays = new Date(this.year, this.month + 1, 0).getDate();
    for (let i = 1; i <= this.numberOfDays; i++) {
      document.querySelector(".days").innerHTML += `<li><div class="date">${i}</div><div class="meal ${currentMonth[this.month]}-${i}"></div></li>`;
    }
  }
}

let calendar = new Calendar();
//Display current month
calendar.monthHeader();

//Display Days
calendar.generateDays();

//Generate Past Months
document.querySelector(".prevMonth").addEventListener("click", function(event){
  event.preventDefault();
  calendar.clearCalendar();
  if(calendar.month === 0){
    calendar.month = (((calendar.month - 1) % 12) + 12) % 12;
    calendar.year--;
  } else {
    calendar.month = (calendar.month - 1) % 12;
  }
 
  calendar.monthHeader();
  calendar.generateDays();
});

//Generate Future Months
document.querySelector(".nextMonth").addEventListener("click", function(event){
  event.preventDefault();
  calendar.clearCalendar();
  if(calendar.month === 11){
    calendar.month = (calendar.month + 1) % 12;
    calendar.year++;
  } else {
    calendar.month = (calendar.month + 1) % 12;
  }
 
  calendar.monthHeader();
  calendar.generateDays();
});

//Add an appointment
document.querySelector(".May-1").innerHTML = `<div class="single">Blah blah</div>`;
document.querySelector(".May-1").innerHTML += `<div class="single">Blah blah</div>`;
              
            
!
999px

Console