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

              
                <html lang="fr"> 
<head>

  <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="https://fonts.googleapis.com/css?family=Esteban" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">

     
</head>
<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>
              
            
!

CSS

              
                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;
	}
}
              
            
!

JS

              
                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,
    text;
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;
  
    switch(char){
      case ',':
        setTimeout(type, 700);
      break;
        
      case '.': 
        setTimeout(type, 1100);
      break;
        
      default:
        if(isTag) return type();
        setTimeout(type, speed);
      break;
    }
};

setTimeout(type, 2000);



(function(){
    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"; 
            
        }
    });
})();
              
            
!
999px

Console