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

              
                <body>
  <h1>WELCOME&nbsp;TO CHEMIE'S TRIVIA&nbsp;QUIZ!</h1>
  <p>Just click the option that you think is the correct answer to the question.</p><hr/><!--Hamburger Menu-->
  <span class="container">
      <span class="checkbox-container">
        <input class="checkbox-trigger" type="checkbox"  />
        <span class="menu-content">
            <ul>
					<li><a href="https://codepen.io/chemie/full/WojEdJ" target="_blank">HOME</a></li>
              <li><a href="https://codepen.io/chemie/full/zozvNE" target="_blank">HANGMAN</a></li>
              <li><a href="https://codepen.io/chemie/full/aBwvYG" target="_blank">MEMORY</a></li>
            </ul>
            <span class="hamburger-menu"></span>
  </span>
  </span>
  </span>
  <!--End of hamburger menu-->
  <button class="start" id="startbutton" onclick="startbutton()">Start</button>
  <center><img id="thinker" src="https://cdn.shopify.com/s/files/1/1061/1924/products/Thinking_Face_Emoji_grande.png?v=1469791175"/></center>
  <!-- Questions and Answers -->
  <div class="Questions" id="Question1">1. Mr Pibb was a soft drink made by the Coca-Cola company to rival what drink?</div>
    <button class="Answers Wrong One" id="q1a1" onclick="allAnswers1()">Sprite</button>
    <button class="Answers Wrong One" id="q1a2" onclick="allAnswers1()">Minute Maid</button>
    <button class="Answers Correct One" id="q1a3" onclick="allAnswers1();correctAnswer()">Dr. Pepper</button>
    <button class="Answers Wrong One" id="q1a4" onclick="allAnswers1()">Fanta</button>
  <div class="Questions" id="Question2">2. What is the name of the scale used the measure the spiciness of peppers?</div>
    <button class="Answers Correct Two" id="q2a1" onclick="allAnswers2();correctAnswer()">Scoville Scale</button>
    <button class="Answers Wrong Two" id="q2a2" onclick="allAnswers2()">Pepper Scale</button>
    <button class="Answers Wrong Two" id="q2a3" onclick="allAnswers2()">Spiciness Scale</button>
    <button class="Answers Wrong Two" id="q2a4" onclick="allAnswers2()">Zesty Scale</button>
  <div class="Questions" id="Question3">3. Pho is a popular noodle soup from what country?</div>
    <button class="Answers Wrong Three" id="q3a1" onclick="allAnswers3()">Thailand</button>
    <button class="Answers Correct Three" id="q3a2" onclick="allAnswers3();correctAnswer()">Vietnam</button>
    <button class="Answers Wrong Three" id="q3a3" onclick="allAnswers3()">Mongolia</button>
    <button class="Answers Wrong Three" id="q3a4" onclick="allAnswers3()">Malaysia</button>
  <div class="Questions" id="Question4">4. Red Vines is a popular brand of what kind of candy?</div>  
    <button class="Answers Correct Four" id="q4a1" onclick="allAnswers4();correctAnswer()">Red Licorice</button>
    <button class="Answers Wrong Four" id="q4a2" onclick="allAnswers4()">Sour Candy</button>
    <button class="Answers Wrong Four" id="q4a3" onclick="allAnswers4()">Candy Canes</button>
    <button class="Answers Wrong Four" id="q4a4" onclick="allAnswers4()">Red Chocolate Sticks</button>
  <div class="Questions" id="Question5">5. The taste that allows us to taste savoury food is called…</div>  
    <button class="Answers Wrong Five" id="q5a1" onclick="allAnswers5()">Salt</button>
    <button class="Answers Wrong Five" id="q5a2" onclick="allAnswers5()">Whiffler</button>
    <button class="Answers Correct Five" id="q5a3" onclick="allAnswers5();correctAnswer()">Umami</button>
    <button class="Answers Wrong Five" id="q5a4" onclick="allAnswers5()">Alginate</button>
  <div class="Questions" id="Question6">6. The paperboard “Chinese Takeout” was invented in what country?</div>
    <button class="Answers Wrong Six" id="q6a1" onclick="allAnswers6()">Taiwan</button>
    <button class="Answers Wrong Six" id="q6a2" onclick="allAnswers6()">China</button>
    <button class="Answers Wrong Six" id="q6a3" onclick="allAnswers6()">Britain</button>
    <button class="Answers Correct Six" id="q6a4" onclick="allAnswers6();correctAnswer()">United States</button>  
  <div class="Questions" id="Question7">7. Margarine is sold as a replacement of what?</div>
    <button class="Answers Wrong Seven" id="q7a1" onclick="allAnswers7()">Cheese</button>
    <button class="Answers Wrong Seven" id="q7a2" onclick="allAnswers7()">Jam</button>
    <button class="Answers Correct Seven" id="q7a3" onclick="allAnswers7();correctAnswer()">Butter</button>
    <button class="Answers Wrong Seven" id="q7a4" onclick="allAnswers7()">Marmalade</button>
  <div class="Questions" id="Question8">8. Chimichurri is a green sauce originated in what country?</div>
    <button class="Answers Wrong Eight" id="q8a1" onclick="allAnswers8()">Korea</button>
    <button class="Answers Wrong Eight" id="q8a2" onclick="allAnswers8()">Japan</button>
    <button class="Answers Correct Eight" id="q8a3" onclick="allAnswers8();correctAnswer()">Argentina</button>
    <button class="Answers Wrong Eight" id="q8a4" onclick="allAnswers8()">Kazakhstan</button>
  <div class="Questions" id="Question9">9. What is a traditional fermented Korean side dish made of seasoned vegetables and salt?</div>
    <button class="Answers Wrong Nine" id="q9a1" onclick="allAnswers9()">Samgyeopsal</button>
    <button class="Answers Wrong Nine" id="q9a2" onclick="allAnswers9()">Bingsu</button>
    <button class="Answers Wrong Nine" id="q9a3" onclick="allAnswers9()">Bulgogi</button>
    <button class="Answers Correct Nine" id="q9a4" onclick="allAnswers9();correctAnswer()">Kimchi</button>
  <div class="Questions" id="Question10">10. A teetotaler is a person that never drinks what?</div>
    <button class="Answers Correct Ten" id="q10a1" onclick="allAnswers10();correctAnswer()">Alcohol</button>
    <button class="Answers Wrong Ten" id="q10a2" onclick="allAnswers10()">Milk</button>
    <button class="Answers Wrong Ten" id="q10a3" onclick="allAnswers10()">Smoothies</button>
    <button class="Answers Wrong Ten" id="q10a4" onclick="allAnswers10()">Soft Drinks</button>
<br>
<br>
	<p id="preScore">Score:</p>
	<p id="theScore">0/10</p>
</body>
  

              
            
!

CSS

              
                /*Import Fonts*/
@import url('https://fonts.googleapis.com/css?family=Nunito|Poppins');

/*Styling body*/
body {
  background-color: #00ffcb; 
  color: black;
  font-family: 'Poppins', sans-serif;
  text-align: center;
}

/*Styling p*/
p {
	background-color: #00ffcb;
  color: black;
  font-family: 'Poppins', sans-serif;
  text-align: center;
}

/*Styling .questions*/
.Questions {
  background-color: #00ffcb; 
  color: black;
  font-family: 'Poppins', sans-serif;
  text-align: left;
}

/*Styling header*/
h1 {
  text-align: center;
  color: white;
  font-family: sans-serif;
  font-family: 'Nunito', sans-serif;
  font-weight: bold;
  text-shadow: 2px 2px #ff0083;
}

/*Styling buttons*/
#startbutton {
    font-family: 'Poppins', sans-serif;
    background-color: #ff0083;
    border: none;
    color: white;
    padding: 10px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
}

/*Styling images*/
#thinker {
  padding-top: 20px;
  height: 300px;
}

/*Styling Questions*/
.Questions{
  visibility: hidden;
}

/*Styling Answers*/
.Answers {
    font-family: 'Poppins', sans-serif;
    background-color: white;
    border: none;
    color: #ff0083;
    padding: 10px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 5px;
    visibility: hidden;
}

.Answers:hover {
  background-color: #ff0083;
  color: white;
}

.Answers:focus {
	background-color: #ff0083;
	color: white;
}

/*Scores*/
#preScore {
	visibility: hidden;
}

#theScore {
	visibility: hidden;
}
/*HAMBURGER MENU CSS*/
.checkbox-container {
  display: block;
  float: left;
  width: 50px;
  height: 50px;
  position: relative;
  background: #182825;
}

.checkbox-trigger {
  opacity: 0;
  position: absolute;
  width: 50px;
  height: 50px;
  left: 0px;
  cursor: pointer;
  z-index: 5;
}

.hamburger-menu,
.hamburger-menu::before,
.hamburger-menu::after {
  display: block;
  position: absolute;
  background: white;
  width: 40px;
  height: 4px;
  margin: 1.3em 3em;
  transition: background 0.3s;
}

.hamburger-menu::before,
.hamburger-menu::after {
  content: '';
  position: absolute;
  margin: -0.7em 0 0;
}

.hamburger-menu::after {
  margin-top: 0.7em;
}

.hamburger-menu {
  position: relative;
  display: block;
  margin: 0;
  margin-top: 1.45em;
  margin-right: 0.35em;
  margin-left: 0.35em;
  margin-bottom: 1.45em;
}

.checkbox-trigger:checked {
  left: 152px;
}

.checkbox-trigger:checked + .menu-content ul {
  width: 150px;
  height: 150px;
  ;
  transition: width 0.7s ease 0.3s, height 0.3s ease;
}

.menu-content {
  display: flex;
  background: #00ffcb;
  color: black;
  float: left;
}

.menu-content ul {
  display: block;
  padding-left: 0;
  padding-top: 1em;
  padding-bottom: 1em;
  margin: 0;
  width: 0px;
  height: 0px;
  overflow: hidden;
  transition: height 0.3s ease 0.7s, width 0.7s ease;
}

.menu-content ul li {
  list-style: none;
  padding-top: 1em;
  padding-bottom: 1em;
  cursor: pointer;
  text-align: center;
  font-family: Helvetica;
  transition: color 0.5s, background 0.5s;
}

.menu-content ul li a {
  color: #FF0083;
  text-decoration: none;
  padding-top: 15px;
  padding-bottom: 15px;
  padding-left: 50px;
  padding-right: 80px;
}

.menu-content ul li a:hover {
  color: white;
  background: black;
}

.menu-content ul li:hover {
  color: white;
  background: black;
}
/*END OF HAMBURGER MENU CSS*/


              
            
!

JS

              
                
  var numQuestions = document.getElementsByClassName("Questions");
  var numAnswers = document.getElementsByClassName("Answers");
  var question1Answers = document.getElementsByClassName("One");
  var question2Answers = document.getElementsByClassName("Two");
  var question3Answers = document.getElementsByClassName("Three");
  var question4Answers = document.getElementsByClassName("Four");
  var question5Answers = document.getElementsByClassName("Five");
  var question6Answers = document.getElementsByClassName("Six");
  var question7Answers = document.getElementsByClassName("Seven");
  var question8Answers = document.getElementsByClassName("Eight");
  var question9Answers = document.getElementsByClassName("Nine");
  var question10Answers = document.getElementsByClassName("Ten");
  var startClass = document.getElementById("startbutton").className;
  var submitButton = document.getElementById("submitanswers");
function startbutton() {
  if (startClass == "start") {
    document.getElementById("thinker").style.width = "0px";
    document.getElementById("thinker").style.height = "0px";
	 document.getElementById("startbutton").style.visibility = "hidden";
	 document.getElementById("preScore").style.visibility = "visible";
	 document.getElementById("theScore").style.visibility = "visible";
    document.getElementById("Question1").style.visibility = "visible";
    for (var i = 0; i < question1Answers.length; i++) {
      question1Answers[i].style.visibility = "visible";
    }
  } 
}

function allAnswers1(){	
	document.getElementsByClass("One").disabled = "true";
	document.getElementsByClass("Two").style.visibiliy = "true";
	document.getElementById("Question2").style.visibility = "true";
}

function allAnswers2(){
	document.getElementsByClass("Two").disabled = "true";	
	document.getElementsByClass("Three").style.visibility = "true";
	document.getElementById("Question3").style.visibility = "true";
}

function allAnswers3(){
	document.getElementsByClass("Three").disabled = "true";
	document.getElementsByClass("Four").style.visibility = "true";
	document.getElementById("Question4").style.visibility = "true";
}

function allAnswers4(){
	document.getElementsByClass("Four").disabled = "true";
	document.getElementsByClass("Five").style.visibility = "true";
	document.getElementById("Question5").style.visibility = "true";
}

function allAnswers5(){
	document.getElementsByClass("Five").disabled = "true";
	document.getElementsByClass("Six").style.visibility = "true"
	document.getElementById("Question6").style.visibility = "true";
}

function allAnswers6(){
	document.getElementsByClass("Six").disabled = "true";
	document.getElementsByClass("Seven").style.visibility = "true";
	document.getElementById("Question7").style.visibility = "true";
}

function allAnswers7(){
	document.getElementsByClass("Seven").disabled = "true";
	document.getElementsByClass("Eight").style.visibility = "true";
	document.getElementById("Question8").style.visibility = "true";
}

function allAnswers8(){
	document.getElementsByClass("Eight").disabled = "true";
	document.getElementsByClass("Nine").style.visibility = "true";
	document.getElementById("Question9").style.visibility = "true";
}

function allAnswers9(){
	document.getElementsByClass("Nine").disabled = "true";
	document.getElementsByClass("Ten").style.visibility = "true";
	document.getElementById("Question10").style.visibility = "true";
}

function allAnswers10(){
	document.getElementsByClass("Ten").disabled = "true";
	document.getElementsByClass("Correct").style.backgroundColor = "green";
	document.getElementsByClass("Wrong").style.backgroundColor = "red";
}

function correctAnswer(){
	var score = score + 1;
	document.getElementById("theScore").innerHTML = score + "/10"
}
              
            
!
999px

Console