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 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

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

              
                <!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
  <meta charset="utf-8">
  <title>Love Calculator</title>
  <!-- favicon-->
  <link rel="shortcut icon" href="/heart.ico">
  <!-- Style Sheet  -->
  <link rel="stylesheet" href="/calculator.css">
  <!-- icons -->
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
  <!-- fonts  -->
  <link href="https://fonts.googleapis.com/css?family=Gamja+Flower|Lobster|Montserrat|Raleway" rel="stylesheet">
</head>

<body>
  <div id="love-calculator" class="calculator">
    <form id="loveForm" id="loveform" class="" action="/" onsubmit="return loveValidation()" method="post">
      <h1>Welcome <i class="fas fa-heartbeat"></i></h1>
      <h2 id="lovefinal">Calculate your love score</h2>
      <p>Please enter names below</p>
      <h2>Your Name</h2>
      <input id="firstname" class="yourname name-box" type="text" name="firstName" placeholder="Your Name"></input>
      <h2>Lover's Name</h2>
      <input id="lovername" class="lovername name-box" type="text" name="lovername" placeholder="Lover's Name"></input>
    </form>
    <button id="love-button" onclick="loveCalculator()" class="buttons" type="submit" value="Submit"><i class="fas fa-heart"></i> Submit</button>
    <button onclick="resetFunction()" class="buttons" type="submit"><i class="fas fa-heart-broken"></i> Reset</button>
    <footer>
      <a href="https://www.linkedin.com/in/tylerbakker35699864"><i class="social-media fab fa-1x fa-linkedin"></i></a>
      <a href="https://www.instagram.com/traizon_webdev/"><i class="social-media fab fa-1x fa-instagram"></i></a>
      <p id="notice">*Note:More updates coming soon!</p>
      <p>© 2019 Tyler Bakker</p>
    </footer>
  </div>
  <script src="/index.js" charset="utf-8"></script>
</body>

</html>
              
            
!

CSS

              
                body {
    background-image: -webkit-linear-gradient(65deg, #c72c41 70%, #212121 30%);
  background-color: #c7004c;
  color: #ee4266;
  font-family: 'Lobster', cursive;
}

.calculator {
  padding: 50px 50px 20px 50px;
  text-align: center;
  margin-left: 300px;
  margin-top: 100px;
  background-color:#211717;
  width: 50%;
}

.name-box {
  padding: 12px 14px;
  width: 40%
}

/* buttons */
.buttons {
  color: #ffd7e8;
  background-color: #ffaaaa;
  border: solid;
  border-color: #ee4266;
  cursor: pointer;
  margin: 10px 10px;
  padding: 10px 20px 10px 20px;
  position: relative;
  opacity: 0.5;
  font-size: 1rem;
}

.buttons:hover {
  box-shadow: 5px 3px #bd245f;
  opacity: 1;
  color: #ee4266;
}
/* Social Media  */
.social-media{ opacity:0.5;
  cursor:pointer;
  padding: 10px 3px 0 4px}
  .social-media:hover{opacity: 1;}
 a{color:#ee4266;}
 /* copy right  */
 p{opacity: 1;
 font-size: 1rem;}
 #notice{opacity: 0.5;
 font-size:.8rem;}
/* Media Query */
@media (max-width:600px) {
  .buttons{width:30%;
  border-radius: 5px;}
  .calculator {width: 60%;
    padding: 10px 20px 10px 10px;
    margin-left: 100px;
    margin-top: 50px;
  }
}

              
            
!

JS

              
                //submit button
// jshint esversion:6
var isNotClicked=true;


 var loveCalculator=function () {
  var yourName = document.getElementById("firstname").value;
  var loversName = document.getElementById("lovername").value;
  var loveScore = Math.random() * 100;
  var loveFinal = Math.round(loveScore);
  if (yourName === "") {
    alert("please enter your name");
  } else if (loversName === "") {
    alert("Please enter your lovers name");

  } else if (isNotClicked) {
    document.getElementById("lovefinal").innerHTML = yourName + " and " + loversName + " your lovescore is " + loveFinal + " % ";
    isNotclicked=false;
  }
  else {
    document.getElementById("lovefinal").innerHTML = yourName + " and " + loversName + " your lovescore is " + loveFinal + " % ";
  }
};

//resetbutton
function resetFunction() {
  location.reload();
}

              
            
!
999px

Console