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.

              <html lang="fr"> 

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

  <title>Charlie Immers</title>
  <link rel="stylesheet" href="style.css" />
  <link href="" rel="stylesheet">
  <link href="" rel="stylesheet">

<body class="container">

  <h1>Une superbe histoire</h1>

  <div id="container"></div>

  <button id="button">Rapide</button>

  <script type="text/javascript" src="main.js"></script>

              body {
	font-family: 'Lato', sans-serif;
	font-size: 1.8em;
	background-color: #fdf7eb;
	margin: 0;
	color: #b6584e;
h1 {
	position: relative;
	font-family: 'Esteban', serif;
	animation: appear 1.3s .1s ease-in-out forwards;
	opacity: 0;
	font-size: 2.5em;
	color: #b6584e;
h1:after {
	display: inline-block;
	content: "";
	height: 4px;
	width: 10%;
	background-color: #b6584e;
	position: absolute;
	top: 55%;
	margin-left: 5%;
.container {
	width: 900px;
	margin: 200px auto;
	opacity: .85;
#button {
	position: fixed;
	top: 1em;
	left: 1em;
	padding: 1em 2em;
	border: none;
	color: #141623;
	width: 100px;
	text-align: center;
	font-family: sans-serif;
	letter-spacing: 1px;
	transition: all .2s ease-in-out;
	border: 1px solid #141623;
	background-color: #fdf7eb;
	border-radius: 4px;
	opacity: .8;
#button:hover {
	transform: translateX(10%);
	background-color: #141623;
	border: none;
	color: #f7f7f7;
	opacity: 1;
#button:focus {
	outline: 0;

@keyframes appear {
	from {
		opacity: 0;
	to {
		opacity: 1;
              var str = "Bonjour, vous êtes dans la matrice. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sagittis eleifend dolor in ultricies. Fusce eget placerat sem, ac cursus leo. Curabitur enim nibh, maximus quis diam id, molestie consectetur nisi. Fusce dapibus, ante vel iaculis placerat, dolor dolor accumsan ante, in tristique tortor ex et tortor. Quisque vehicula quam ac orci fringilla laoreet. <br><br> Les fonctions font partie des briques fondamentales de JavaScript. Une fonction est une procédure JavaScript, un ensemble d'instructions effectuant une tâche ou calculant une valeur. Afin d'utiliser une fonction, il est nécessaire de l'avoir auparavant définie au sein de la portée dans laquelle on souhaite l'appeler.",
    i = 0,
    isTag = false,
var speed = 40;

function type(){
    text = str.slice(0, ++i);
    if (text === str) return;
    document.getElementById("container").innerHTML = text;

    var char = text.slice(-1);
    if( char === '<' ) isTag = true;
    if( char === '>' ) isTag = false;
      case ',':
        setTimeout(type, 700);
      case '.': 
        setTimeout(type, 1100);
        if(isTag) return type();
        setTimeout(type, speed);

setTimeout(type, 2000);

    var dButton = document.getElementById("button");
    var bClicked = false;

    dButton.addEventListener("click", function() {
        if(bClicked == false) {
            speed = 20;
            bClicked = true;
            dButton.innerHTML = "Lent";    
        else {
            speed = 40;
            bClicked = false;
            dButton.innerHTML = "Rapide"; 
🕑 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.