Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                
<a class="big-button" href="javascript:window.print()">Print</a>

<select id="mode">
	<option selected>list</option>
	<option>calendar</option>
</select>

<div id="events" class="list">
	<div class="week"></div>
	<div class="week"></div>
	<div class="week"></div>
	<div class="week">
		<!-- example will be replaced by JS -->
		<div class="day">
			<div class="numeral">4/23</div>
			<div class="events">
				<a href="#">
					<div class="title">Example Event</div>
					<div class="info">
						<div class="time">7:16:03 PM</div>
						<div class="description">Lor separat existentie es un myth. Por scientie, musica, sport etc., li tot Europa usa li sam vocabularium. Li lingues differe solmen in.</div>
					</div>
				</a>
			</div>
		</div>
	</div>
</div>
              
            
!

CSS

              
                body {
	max-width: 800px;
	margin: 0 auto;
	padding: 1em;
	font-family: Lato, Helvetica, Arial, sans-serif;
}

@media print {
	body{
		padding:0;
	}
}

.day{
	color:#bbb;
}

.big-button {
	display: block;
	font-size: 120%;
	border: solid 1px #5d584f;
	background-color: #7b756d;
	color: #64D4D0;
	padding: 0.4em 0.1em 0.25em;
	margin: 0.3em 0;
	border-radius: 0.1em;
	text-decoration: none;
	text-align: center;
	font-weight: 800;
	text-shadow: 0px -1px 0 #303030;
	box-shadow: 0 3px 0 #5d584f;
}

@media print {
	.big-button,
	#mode{
		display:none;
	}
}

#events {
	border: 0;
	font-size: 18px;
}

@media print {
	#events {
		font-size: 10px;
	}
}

#events .numeral {
	font-size: 200%;
}

#events a {
	display: block;
	text-decoration: none;
	color: black;
}

#events a .title {
	font-weight: 600;
	font-size: 120%;
}

.calendar .week {
	display: table-row;
	page-break-inside: avoid;
}

.calendar .day {
	display: table-cell;
	vertical-align: top;
	padding: 1em 0.25em;
	min-width: 7em;
}

.calendar .events a {
	margin-bottom: 0.25em;
	border-bottom: solid 1px black;
}

.calendar .numeral {
	font-size: 200%;
}

.calendar .description {
	display: none;
}

.list .description {
	text-align: justify;
	text-justify: newspaper;
}

@media print {
	.list {
		column-width: 18em;
		column-gap: 2em;
	}
}

.list .day {
	padding-bottom: 1em;
	margin-bottom: 1em;
	border-bottom: solid 1px black;
	page-break-inside: avoid;
}

.list a {
	margin-top:0.5em;
	margin-bottom: 1.5em;
	page-break-inside: avoid;
}

.list .time {
	width: 25%;
}

.list .description {
	width: 75%;
}

.list .info > * {
	float: left;
}

.list .info:after {
	content: '';
	display: block;
	float: none;
	clear: both;
}

.list .empty.day {
	display: none;
}
              
            
!

JS

              
                var events_el = document.getElementById('events');

var mode_el = document.getElementById('mode');
mode_el.onchange = function(event) {
	events_el.classList.remove('calendar');
	events_el.classList.remove('list');
	events_el.classList.add(event.target.value);
//	console.log(events_el.classList);
}

function loremIpsum(words){
	var lipsum = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. Defacto lingo est igpay atinlay. Marquee selectus non provisio incongruous feline nolo contendre. Gratuitous octopus niacin, sodium glutimate. Quote meon an estimate et non interruptus stadium. Sic tempus fugit esperanto hiccup estrogen. Glorious baklava ex librus hup hey ad infinitum. Non sequitur condominium facile et geranium incognito. Epsum factorial non deposit quid pro quo hic escorol. Marquee selectus non provisio incongruous feline nolo contendre Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc., li tot Europa usa li sam vocabularium. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilit? de un nov lingua franca: on refusa continuar payar custosi traductores. It solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles. Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues. It va esser tam simplic quam Occidental: in fact, it va esser Occidental. A un Angleso it va semblar un simplificat Angles, quam un skeptic Cambridge amico dit me que Occidental es.".split(' ');
	var start = Math.floor(Math.random() * lipsum.length);
	return lipsum.slice(start,start+words).join(' ');
}

var date_time = new Date(Math.floor(Math.random()*1452003000000));

function loremTimesum(){
	var date = new Date(Math.floor(Math.random()*1452003000000));
	//q.setTime(q.valueOf() + 86400000);
	console.log('date',date);
	return date.toLocaleTimeString();

//	return date.toDateString();
}

var date = new Date(Math.floor(Math.random()*1452003000000));
function getDay(){
	var dateMonth = date.getMonth();
	var dateDay = date.getDate();
	var day = [
			'<div class="day">',
				'<div class="numeral">'+dateMonth+'/'+dateDay+'</div>',
				'<div class="events"></div>',
			'</div>'
	].join('');
	date = new Date(date.getTime() + 86400000);
	return day;
}

var weeks = document.querySelectorAll('#events .week');
for(var week in weeks){
	var days = [];
	for(var i=0; i<7; i++){
		days.push(getDay());
	}
	weeks[week].innerHTML = days.join('');
}

function generateEvents(){

	var days = document.querySelectorAll('#events .day');
	for(i=0; i<days.length; i++){
		var empty = Math.random() < 0.2;
		if(empty){
			days[i].classList.add('empty');
		}else{
			var dayEvents = days[i].querySelector('.events');
			var links = [];
			var linkCount = Math.floor(Math.random()*12);
			for(j=linkCount; j>0; j--){
				var link = [
					'<a href="#">',
						'<div class="title">'+loremIpsum(4)+'</div>',
						'<div class="info">',
							'<div class="time">'+loremTimesum()+'</div>',
							'<div class="description">'+loremIpsum(Math.floor(Math.random()*26)+4)+'</div>',
						'</div>',
					'</a>'
				].join('');
				links.push(link);
			}
			dayEvents.innerHTML = links.join('');
		}
	}
}
generateEvents();

              
            
!
999px

Console