cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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>

<head>
		<meta charset="UTF-8">
		<title>Mad Libs</title>
		<link rel="stylesheet" href="css/style.css">
		<link href='https://fonts.googleapis.com/css?family=Fugaz+One' rel='stylesheet' type='text/css'>

		<meta charset="utf-8" />
		<title>Mad Libs</title>
</head>

<body>
		<h1>Mad Libs</h1>
<!--Create a div for the game-->
		<div id="forms"> 
				<p>Noun:</p>
<!--Give each input an id-->
				<input type="text" id="noun">
				<p>Adjective:</p>
				<input type="text" id="adjective">
				<p>Verb (past-tense)</p>
				<input type="text" id="verb">
				<p>Someone's Name:</p>
				<input type="text" id="name">
				<p>Exclamation: </p>
				<input type="text" id="exclamation">

		</div>
<!--Use a button to launch the function-->
		<button id="lib-button" onclick="madLibs()">lib it!</button>
		<div id="story"></div>


</body>

</html>
            
          
!
            
              * {
		font-family: Fugaz One;
		font-size: 22px;
		text-align: center;
		line-height: 5px;
}

h1 {
		text-align: center;
		font-family: Fugaz One;
		font-size: 72px;
		color: #FF3D96;
}

button {
		height: 50px;
		font-family: ;
		font-size: 22px;
		font-variant: small-caps;
}

#story {
		font-size: 24px;
		text-align: center;
		padding-top: 35px;
		font-family: Courier;
		line-height: 1;
}

input {
		font-family: Courier;
		border: 5px solid white;
		-webkit-box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1), 0 0 16px rgba(0, 0, 0, 0.1);
		-moz-box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1), 0 0 16px rgba(0, 0, 0, 0.1);
		box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1), 0 0 16px rgba(0, 0, 0, 0.1);
		padding: 15px;
		background: rgba(255, 255, 255, 0.5);
		margin: 0 0 10px 0;
}
            
          
!
            
              // This whole page works using just one function:
var madLibs = function() {
		// We will create a variable for each section of the page- the 5 inputs, and the empty <div> where the finished story will go. 
		var storyDiv = document.getElementById("story");
		var name = document.getElementById("name").value;
		var adjective = document.getElementById("adjective").value;
		var noun = document.getElementById("noun").value;
		var exclamation = document.getElementById("exclamation").value;
		var verb = document.getElementById("verb").value;
		// Once we create all of our variables, we change the HTML of our story <div> using innerHTML and adding a bunch of strings together, with punctuation and spaces. 
		storyDiv.innerHTML = name + " " + verb + " a " + adjective + " " + noun + ", " + exclamation + "!";
}

/*var libButton = document.getElementById('lib-button');
libButton.addEventListener('click', madLibs);*/
            
          
!
999px
Loading ..................

Console