css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <body>
<section>

<table id="calendar" >
	<div class='data'>
	<input type='text' id='year' placeholder='Enter Four Digit Year'/>
	<input type='text' id='month' placeholder='Enter Numeric Month'/>
  <input type='reset' id='reset' value='Clear Calendar'/>
	<input type='submit' id='create' value='Make Calendar'/>
	</div>
		<thead>
		<tr>
			   <th id = "dayOfWeek">Sunday</th>
               <th id = "dayOfWeek">Monday</th>
               <th id = "dayOfWeek">Tuesday</th>
               <th id = "dayOfWeek">Wednesday</th>
			   <th id = "dayOfWeek">Thursday</th>
			   <th id = "dayOfWeek">Friday</th>
			   <th id = "dayOfWeek">Saturday</th>
		</tr>
		</thead>
		<tbody id="cal"></tbody>
</table>
</div>
</body>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Cuprum);

body{
	background:hsla(210, 75%, 5%, 1);
	font-family: 'Cuprum', sans-serif;
	width:100%;
  overflow:hidden;
  font-smoothing: subpixel-antialiased;
}
section{
	width:100%;
	margin:auto;
	font-size: 1.5vw;
  padding:10vw;
  transition:all 2s ease;
}
table#calendar{
	width:80vw; 
	padding:2.5vw; 
	text-align:center;
	background:hsla(176, 65%, 15%, .8);
	color:hsla(191, 65%, 5%, 1);
	border:none;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  user-select:none;
  outline:none;
}
table th{
  background:hsla(191, 75%, 85%, .8);
	padding:1.2vw;
  border:none;
}
table tr{
	padding:1vw;
  transform: translate(0,0);
}
table td{
	padding:1.5vw;
  font-size:2vw;
  color:hsla(176, 85%, 85%, 1);1
  text-shadow: -1px 1px hsla(191, 75%, 85%, 1);
  transition:all 1s ease;
}
table td:hover{
	background:hsla(191, 65%, 95%, .7);
  border-radius:2px;
	box-shadow: 1px 1px 1px hsla(197, 55%, 5%, .2);
  color:hsla(191, 65%, 5%, 1);
}
.data{
	width:80vw;
	text-align:center;
	display:inline-block;
	background:hsla(165, 75%, 45%, 1);
	box-shadow: 1px 0 0 1px hsla(197, 35%, 5%, .1);
}
#create, #reset{
	border:none;
	width:15vw;
	padding:1.37vw;
	color:#fff;
	font-family: 'Cuprum', sans-serif;
	font-weight:bold;
  font-size:1.5vw;
	background:	hsla(191, 65%, 5%, .2);
  user-select:none;
  outline:none;
  float:right;
  margin:.2%;
}
#create:hover, #reset:hover{
  box-shadow: 1px 0 0 0 hsla(197, 35%, 5%, .3);
}
#create:active, #reset:active{
  user-select:none;
  outline:none;
}
input[type=text]{ 
	padding:1.2vw;
  text-align:center;
	border:none;
	background: hsla(191, 55%, 95%,.2);
	color:hsla(191, 65%, 5%, 1);
	font-family: 'Cuprum', sans-serif;
	font-weight:bold;
  font-size:1.5vw;
  width:15vw;
  float:left;
  margin:.5%;
  user-select:none;
  outline:none;
}
input:focus{
  box-shadow: inset 2px 1px 1px 1px hsla(197, 35%, 5%, .1);
}
[placeholder]:focus::-webkit-input-placeholder { 
	  color:hsla(191, 65%, 5%, 1);
    user-select:none;
    outline:none;
}
[placeholder]:focus::-moz-placeholder {
	color:hsla(191, 65%, 5%, 1);
  user-select:none;
  outline:none;
 }
            
          
!
            
              
var $ = function (id) {
    return document.getElementById(id);
 };

window.onload = function () {
 //assign button behaviour to functions
  $('create').onclick = myCalendar;
  $('reset').onclick = clearCalendar;
  };
//User input function (calendar creation based on user inputs)
function myCalendar(){

	//assign var year to the user input value 
	var year = $('year').value
	
	//assign var month to the user input value
	var month = $('month').value
	
	//invoke new calendar
	new Calendar("cal", year, month);
}
//Calendar creator function
function Calendar(id, year, month) {
 
  //assign var elem to the div in which calendar will be drawn. 
  //In this case, #cal
  var elem = $('cal')
  
  // (1) Get Date: month -1 because counter starts at 0. So if you enter 12, the date object will look for a 13th month. So minus 1 so if you enter 12, you get dec. 
  var mon = month - 1  
  
  var d = new Date(year, mon)
  
  //start table drawing
  var table = ['<table><tr>']

  // (2) get start day of month and fill first row 
  //  0  1  2  3  4  5  6
  for (var i=0; i<d.getDay(); i++) {
    table.push('<td></td>')
  }
  
  // main body (3) //fill in rest of rows based on month
  while(d.getMonth() == mon) {
    table.push('<td>'+d.getDate()+'</td>')
	
 // (4)if 7 days in the week to be filled- create rows. 
    if (d.getDay() % 7 == 6) {   
      table.push('</tr><tr>')
    }
	
 //set date: add 1 because counter starts at 0, but our days start at 1..
 //so add 1.
    d.setDate(d.getDate()+1)  
  }
  
  // (5) if less than 7 days, blank spaces
  for (var i=d.getDay(); i<7; i++) {
    table.push('<td></td>')
  }
  // table closure
  table.push('</tr></table>')
  
  //join all rows created above to create complete table and draw.
  elem.innerHTML = table.join('\n')
}
//Reset function
function clearCalendar(){

	//reset input value for year
	$('year').value='';
	
	//reset input value for month
	$('month').value='';
	
	//clear calendar table
	$('cal').innerHTML='';
}



/*Life's Not Complete Without Art.   

#####################################################
#######_#########################################TMR#
######/ \#####_________######_______#################
#####|\ /|###(_________)####(_______)###_____###__###
#####| V |###|  |###|  |####|  \#/  |##(_____)#(__)##
#####| | |___|   |##|  |_###|   |   |#|  \#/ |#\  |##
###__| | |___|   |##|  | |##|   |   |#|  |#| |#|  |##
##(__| | | V_|   |##|  | |##|   |   ||   |#| |#|  |##
##||#| | |_/_|    |/   | |#|    |   ||   ||  |#|  |##
##||#| | |###|    /    |###|    |   |    |   |#|  |##
`````````````````````````````````````````````````````
STONEHENDGE

*/
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console