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

              
                <!-- Code By Sofia Silva -->
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link href="style.css" rel="stylesheet"></link>
  <link href="https://fonts.googleapis.com/css?family=Annie+Use+Your+Telescope|Jim+Nightshade|Pangolin" rel="stylesheet">
  <title>"Mad Libs" Harry Potter edition</title>
</head>

<body>
  <div class="Container">
    <h1>"Mad Libs"<span class="scar"><img  src="https://s15.postimg.cc/pk0nzkuy3/bolt.png" alt="scar icon"></span>Harry Potter edition</h1>
    <form id="formContent">
      <div class="row">
        <div class="column">
          Verb in past tense: <input id="livedReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br> 
          Number: <input id="number4Replacer" onchange="displayChanges()" type="text" autocomplete="off" /><br>
          Noun: <input id="driveReplacer"
            onchange="displayChanges()" type="text" autocomplete="off" /><br>
          Adjective: <input id="normalReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br>
          Adjective: <input id="strangeReplacer" onchange="displayChanges()" type="text"
            autocomplete="off" /><br>
          Adjective: <input id="mysteriousReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br>
          Verb in First Person: <input id="holdReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br> 
          Made-up Name: <input id="grunningsReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br>
        </div>

        <div class="column">
          Object Plural: <input id="drillsReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br> Adjective: <input id="beefyReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br>
          Body Part: <input id="neckReplacer"
            onchange="displayChanges()" type="text" autocomplete="off" /><br> Adjective: <input id="largeReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br>
          Adjective: <input id="thinReplacer" onchange="displayChanges()" type="text"
            autocomplete="off" /><br>
          Verb -ing: <input id="craningReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br>
          Adjective: <input id="smallReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br> 
          Noun: <input
            id="secretReplacer" onchange="displayChanges()" type="text" autocomplete="off" /><br>
        </div>
      </div>
      <input id="submit" class="button" value="Submit" type="submit"><br>
    </form>
    <button id="seeOriginal" class="button unToggled">Compare to Original</button>
    <!-- <button class="button refresh" onClick="window.location.reload()">Another!</buttom> -->

    <div class="finalTextContainer">
      <h2>The Boy Who <span class="lived">Lived</span></h2>
      <p class="textContent">Mr and Mrs Dursley, of number <span class="number4">4</span>, Private <span class="drive">Drive</span>, were proud to say that they were perfectly <span class="normal">normal</span>, thank you very much. They were the last people you'd expect to
        be involved in anything <span class="strange">strange</span> or <span class="mysterious">mysterious</span>, because they just didn't <span class="hold">hold</span> with such nonsense.</p>

      <p class="textContent">Mr Dursley was the director of a firm called <span class="grunnings"> Grunnings</span>, which made <span class="drills">drills</span>. He was a big, <span class="beefy">beefy</span> man with hardly any <span class="neck">neck</span>, although he
        did have a very <span class="large">large</span> moustache. Mrs Dursley was <span class="thin">thin</span> and blonde and had nearly twice the usual amount of <span class="secondNeck">neck</span>, which came in very useful as she spent so much
        of her time <span class="craning">craning</span> over garden fences, spying on the neighbours. The Dursleys had a <span class="small">small</span> son called Dudley and in their opinion there was no finer boy anywhere.</p>

      <p class="textContent">The Dursleys had everything they wanted, but they also had a <span class="secret">secret</span>, and their greatest fear was that somebody would discover it. They didn't think they could bear it if anyone found out about the Potters.</p>
    </div>
    <div class="originalTextContainer">
      <h2>The Boy Who <span>Lived</span></h2>
      <p class="textContent">Mr and Mrs Dursley, of number <span>4</span>, Private <span style="text-transform: capitalize;">Drive</span>, were proud to say that they were perfectly <span>normal</span>, thank you very much. They were the last people you'd expect to be involved
        in anything <span>strange</span> or <span>mysterious</span>, because they just didn't <span>hold</span> with such nonsense.</p>

      <p class="textContent">Mr Dursley was the director of a firm called <span style="text-transform: capitalize;"> Grunnings</span>, which made <span>drills</span>. He was a big, <span>beefy</span> man with hardly any <span>neck</span>, although he did have a very <span>large</span>        moustache. Mrs Dursley was <span>thin</span> and blonde and had nearly twice the usual amount of <span>neck</span>, which came in very useful as she spent so much of her time <span>craning</span> over garden fences, spying on the neighbours. The
        Dursleys had a <span>small</span> son called Dudley and in their opinion there was no finer boy anywhere.</p>

      <p class="textContent">The Dursleys had everything they wanted, but they also had a <span>secret</span>, and their greatest fear was that somebody would discover it. They didn't think they could bear it if anyone found out about the Potters.</p>
    </div>
  </div>
  <footer>
    <p>Coded by <a href="https://github.com/sofiabsilva">Sofia Silva</a>, original text from "Harry Potter and the Philosopher's Stone" by JK Rowling, background by <a href="https://bamberos.deviantart.com/">Bamberos</a></p>
    <div>Icon made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
  </footer>
  <script src="script.js"></script>
</body>

</html>
              
            
!

CSS

              
                /* Code by Sofia Silva */
body {
  color: white;
  background-color: #5c3236;
  font-family: 'Pangolin', cursive;
  /* font-family: 'Annie Use Your Telescope', cursive;
  font-family: 'Princess Sofia', cursive;
  font-family: 'Jim Nightshade', cursive;
  font-family: 'Pangolin', cursive; */
  font-size: 20px;
  background-image: url('https://i.postimg.cc/ZqmcPy10/harry-potter-desk-wallpaper-by-bamberos-compressed.jpg');
  /* background-image: url('https://orig00.deviantart.net/0d65/f/2013/033/e/2/ron_weasley_desk_wallpaper_and_gmail_theme_by_bamberos-d5tmnbs.jpg'); */
  /* background-image: url('https://orig00.deviantart.net/4dcd/f/2008/035/3/7/harry_potter_desk_wallpaper_by_emelody.jpg'); */
  background-size: cover;
  background-position: bottom;
  background-attachment: fixed;
}

h1 {
font-family: 'Jim Nightshade', cursive;
}
.scar img{
  padding: 2px;
  max-width: 50px;
  position: relative;
  top: 20px;

}
.row {
  display: flex;
}
.column {
  flex: 50%;
  text-align: center;
  flex-wrap: wrap;
}
.button {
  background-color: #ffffff0f;
  color: white;
  font-size: 19px;
  border: 2px solid #e7e7e7;
  height: 40px;
  min-width: 150px;
}
.button:hover {
  font-weight: bold;
  border: 2px solid #e7e7e7;
}
input, button {
   display: block;
   margin: auto;
   text-align: center;
}

 #seeOriginal{
  display: none;
}
input[type=text] {
  padding: 6px;
  font-size: 18px;
  margin-top: 5px;
  border-radius: 4px;
}
h1, h2 {
    text-align: center;
}

div.Container {
  display: block;
  width: 70%;
  max-width: 800px;
  margin: auto;
  background-color: #29191a;
  background-color: #29191ae6;
  padding: 15px;
  border-radius: 15px;
}
.finalTextContainer {
  display: none;
}
.originalTextContainer {
  display: none;
}
.textContent {
  padding: 10px;
  margin: auto;
  line-height: 1.6em;
  text-indent: 50px;
}
span {
    text-decoration: underline;
    text-transform: lowercase;
}
.scar {
   text-decoration: none;
}

h2 span, .grunnings, .drive {
  text-transform: capitalize;
}
footer {
    text-align: center;
    font-size: 16px;
    text-shadow: 1px 1px 2px black, 0 0 1em black, 0 0 0.2em black;
}
a {
  color: white;
  text-decoration: none;
  line-height: 1.6em;
}
a:hover {
  text-decoration: underline;
}
@media screen and (max-width: 850px){
  div.Container {
    display: block;
    width: 80%;
    max-width: 800px;
    padding: 5px;
    border-radius: 15px;
    font-size: 17px;
  }
}
@media screen and (max-width: 720px){
  .row {
  display: block;
  }
  h1 {
    font-size: 1.9em;
  }
  h2 {
    font-size: 1.5em;
  }
  div.Container {
      width: 90%;
  }
  body {
    background-repeat: no-repeat;
    background-size: cover;
  }
}
@media screen and (min-width: 1060px){
  div.Container {
    width: 50%;
  }
}
              
            
!

JS

              
                // Code by Sofia Silva
function displayChanges() {
   var livedReplacer = document.getElementById("livedReplacer");
   var number4Replacer = document.getElementById("number4Replacer");
   var driveReplacer = document.getElementById("driveReplacer");
   var normalReplacer = document.getElementById("normalReplacer");
   var strangeReplacer = document.getElementById("strangeReplacer");
   var mysteriousReplacer = document.getElementById("mysteriousReplacer");
   var holdReplacer = document.getElementById("holdReplacer");
   var grunningsReplacer = document.getElementById("grunningsReplacer");
   var drillsReplacer = document.getElementById("drillsReplacer");
   var beefyReplacer = document.getElementById("beefyReplacer");
   var neckReplacer = document.getElementById("neckReplacer");
   var largeReplacer = document.getElementById("largeReplacer");
   var thinReplacer = document.getElementById("thinReplacer");
   var craningReplacer = document.getElementById("craningReplacer");
   var smallReplacer = document.getElementById("smallReplacer");
   var secretReplacer = document.getElementById("secretReplacer");

  /*  var newLived = document.getElementsByClassName("lived")[0];
  // got to use [0] beacause it is getting the ElementsByClassName as an array!
   it's better to use querySelector(".classname")*/
    var newLived = document.querySelector(".lived");
    var newNumber4 = document.querySelector(".number4");
    var newDrive = document.querySelector(".drive");
    var newNormal = document.querySelector(".normal");
    var newStrange = document.querySelector(".strange");
    var newMysterious = document.querySelector(".mysterious");
    var newHold = document.querySelector(".hold");
    var newGrunnings = document.querySelector(".grunnings");
    var newDrills = document.querySelector(".drills");
    var newBeefy = document.querySelector(".beefy");
    var newNeck = document.querySelector(".neck");
    var newLarge = document.querySelector(".large");
    var newThin = document.querySelector(".thin");
    var new2Neck = document.querySelector(".secondNeck");
    var newCraning = document.querySelector(".craning");
    var newSmall = document.querySelector(".small");
    var newSecret = document.querySelector(".secret");

    newLived.innerText = livedReplacer.value;
    newNumber4.innerText = number4Replacer.value;
    newDrive.innerText = driveReplacer.value;
    newNormal.innerText = normalReplacer.value;
    newStrange.innerText = strangeReplacer.value;
    newMysterious.innerText = mysteriousReplacer.value;
    newHold.innerText = holdReplacer.value;
    newGrunnings.innerText = grunningsReplacer.value;
    newDrills.innerText = drillsReplacer.value;
    newBeefy.innerText = beefyReplacer.value;
    newNeck.innerText = neckReplacer.value;
    newLarge.innerText = largeReplacer.value;
    newThin.innerText = thinReplacer.value;
    new2Neck.innerText = neckReplacer.value;
    newCraning.innerText = craningReplacer.value;
    newSmall.innerText = smallReplacer.value;
    newSecret.innerText = secretReplacer.value;
}
var submitButton = document.getElementById("submit");
var finalTextContainer = document.querySelector(".finalTextContainer");
submitButton.addEventListener('click', function(e){
  if (document.querySelector("input").value === "") {
    alert("Make sure to fill all the boxes");
  } else {
    var formContent = document.querySelector("#formContent");
    var seeOriginalButton = document.querySelector("#seeOriginal");
    finalTextContainer.style = 'display: block';
    formContent.style = 'display: none';
    seeOriginalButton.style ='display: block';
    e.preventDefault();
  }
});

var seeOriginalButton = document.querySelector("#seeOriginal");
var originalTextContainer = document.querySelector(".originalTextContainer");
  seeOriginalButton.addEventListener('click', function() {
  if (seeOriginalButton.className === "button unToggled") {
    originalTextContainer.style = 'display: block';
    finalTextContainer.style = 'display: none';
    seeOriginalButton.innerText = "Go Back";
    seeOriginalButton.classList.toggle("unToggled");
  } else {
    originalTextContainer.style = 'display: none';
    finalTextContainer.style = 'display: block';
    seeOriginalButton.classList.toggle("unToggled");
    seeOriginalButton.innerText = "Compare to Original";
  }
});
              
            
!
999px

Console