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

              
                <div id="homepage" class="middle">
	<div id="terminal">
		<div>
			<div id="controls" class="middle"><span></span><span></span><span></span><div class="taille"></div></div>
			<div>Terminal</div>
		</div>
		<div id="content">
		</div>
	</div><span class="taille"></span>
</div>
              
            
!

CSS

              
                @import('https://fonts.googleapis.com/icon?family=Fira+Mono');
body {
	background: url(https://images.unsplash.com/photo-1443926818681-717d074a57af?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=1920&fit=max&s=e435d3ac89330d57124fef0de2aceb35);
	/*
	https://unsplash.com/@marceloquinan?utm_medium=referral&amp;utm_campaign=photographer-credit&amp;utm_content=creditBadge
	Download free do whatever you want high-resolution photos from Marcelo Quinan
	*/
	background-position: center;
	background-size: cover;
	color: white;
}
#homepage {
	height: 100%;
	text-align: center;
	padding: 50px;
}
#terminal {
	min-height: 350px;
	width: 650px;
	max-width: 100%;
	max-height: 100%;
	background: rgba(29, 31, 32, 0.85);
	border-radius: .3rem;
box-shadow: 0 20px 60px 10px rgba(0, 0, 0, 0.5);
	position: relative;
}
#terminal div:first-child div {
	height: 30px;
	line-height: 30px;
}
#controls {
	position: absolute;
}
#controls span {
	width: .875rem;
	height: .875rem;
	background: #fdbc40;
	margin: 0 0 0 8px;
	border-radius: 50%;
}
#controls span:first-child {
	background: #fc615c;
}
#controls span:nth-child(3) {
	background: #33c748;
}
#content {
	font-family: 'Fira Mono', monospace;
	text-align: left;
	font-size: 0.8rem;
	position: absolute;
	top: 30px;
	left: 13px;
	right: 13px;
	bottom: 0;
	overflow: auto;
}
.green { color: #9ADF3A; }
.yellow { color: #FFDE38; }
.red { color: #FF575A; }
.blue { color: #98d7ff; }

#content > div:last-child {
	margin-bottom: 20px;
}
#content form { display: inline; }
#content input {
	text-transform: initial;
}
#content > div, #content p {
	margin: 10px 0;
}
#content b {
	opacity: .3;
}
              
            
!

JS

              
                const commands = {
	presentation: {
		cmd: 'presentation',
		res: 'Yann Le Vaguerès<br>TheRolf<br>Développeur HTML - CSS - JS - jQuery - PHP<br>Designer Photoshop affirmé<br><br><b>Tapez \'help\' pour plus de détails sur les commandes</b>'},
	visitors: {
		cmd: 'visitors',
		res: '<span class="blue">2626</span> visites'
	},
	whoami: {
		cmd: 'whoami',
		res: 'utilisateur: anonyme<br>ip: 12.34.567.890<br>useragent: ' + navigator.userAgent
	},
	help: {
		cmd: 'help',
		res: ' Aide commandes disponibles<br><br> hello	- Dis bonjour<br> clear	- Efface le terminal<br> date	- Renvoie la date<br> help	- Liste des commandes disponibles<br> whoami	- Affiche les informations sur l\'utilisateur'
	},
	visitors : { cmd: 'visitors', res: '<span class="blue">2626</span> visites'},
	hello: { cmd: 'hello', res: 'Salut, mec !'},
	date: { cmd: 'date', res: 'ceci est la date'}
}

const prephrase = '<span class="green">website</span> <span class="yellow"> (therolf)</span> <span class="red">#</span> ';

var form = $('<div>' + prephrase + '<form id="form"><input type="text" class="nostyle" autofocus /></form>').appendTo('#content');

function launchCommand(command) {
	$('<div>' + prephrase + command.cmd + '<p>' + command.res + '</p></div>').insertBefore(form)
}

launchCommand(commands.presentation);
launchCommand(commands.visitors);

$('#content').niceScroll({
	cursorcolor: '#303030',
	cursorborder: '0px none',
	autohidemode: false,
	cursorwidth: "8px",
	cursorborderradius: "4px",
	railpadding: { top: 0, left: 0, right: 0, bottom: 10 }
});

$('form').on('submit', function(e) {
	e.preventDefault();
	try {
		if($('input').val().trim() !== '') {
			launchCommand(commands[$('input').val()]);
		}
	} catch(error) {
		launchCommand({
			cmd: $('input').val(),
			res: '<div><p>' + $('input').val() + ': command not found</p></div>'
		});
		if($('input').val() === 'clear') {
			$('#content > *').not(':last').remove();
		}
	}
	$('input').val('');$('#content').getNiceScroll(0).resize().doScrollTop($('#content')[0].scrollHeight, 0);
})
              
            
!
999px

Console