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

              
                <head>
<meta charset="utf-8">
<title>Enter Title Here</title>
<link rel="icon" 
      type="image/png" 
      href="favicon_1.png">
<link href="Nice.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" defer="true" ></script>
<script src="Nice.js" defer="true" ></script>
</head>
<body>
<h1>Let me ask you a quick question:<br>What's the youngest a girl can be that if we go out, I'm not a total scumbag?</h1>
<iframe width="350" height="275" src="https://zippy.gfycat.com/CoolLinearBeetle.webm" frameborder="0" allowfullscreen id="clip"></iframe>
<br>
<p>What's your age:</p>
<input class="input-box" type="number" id="your-age" min="16" max="123">
<p>What's her age:</p>
<input class="input-box" type="number" id="her-age" min="16" max="123">
<br>
<br>
<button type="button" id="check">Can you date her?</button>
<p id="answer">&nbsp;</p>

              
            
!

CSS

              
                @charset "utf-8";
* {
	font-family: "Microsoft Sans Serif";	
	
}

body {
	background-color: #191919;
	text-align: center;
}

#clip {
	}

h1 {
	color: white;
	font-family: "Microsoft Sans Serif";
	text-align: center;
  font-size: 1.5em
	}

p {
	font-family: Roboto, "Microsoft Sans Serif";
	color: white;
	font-size: 1.5em;
}

input {
	background-color: lightgray;
	border-color: white;
	border-radius: 5px;
	width: 80px;
	font-size: 25px;
	padding: 3px;
}

button {
	color: black;
	font-family:Roboto, "Microsoft Sans Serif";
	border-radius: 3px;
	height: 40px;
	width: 200px;
	font-size: 1.2em;
	margin-top: 25px;
}
              
            
!

JS

              
                var yourAge = document.getElementById("your-age");
var herAge = document.getElementById("her-age");
	
document.getElementById("check").onclick = magicNumber;	
	
function magicNumber() {	
  	var x = (parseFloat(yourAge.value) / 2) + 7;
	var y = (parseFloat(herAge.value) / 2) + 5;
	
	if (x < herAge.value) {
		document.getElementById("answer").innerHTML = "Go for it! You're all clear.";
		document.getElementById("answer").style.color = "lime";
	}	
	if (x > herAge.value) {
		document.getElementById("answer").innerHTML = "Please! You totally can! Tom says it's OK...that probably means it isn't OK....";
		document.getElementById("answer").style.color = "yellow";
	}	
	if (herAge.value < 18 && yourAge.value >= 18) {
		document.getElementById("answer").innerHTML = "You're sick man, don't make me report you!";
		document.getElementById("answer").style.color = "#ff6500";
	}
	if (y > yourAge.value) {
		document.getElementById("answer").innerHTML = "I dunno man, she might be a cougar....";
		document.getElementById("answer").style.color = "yellow";
	}
	if (yourAge.value < 18 && herAge.value >= 18) {
		document.getElementById("answer").innerHTML = "You might want to talk to your parents about this one.";
		document.getElementById("answer").style.color = "#ff6500";
	}
	if (herAge.value > 65 || yourAge.value > 65) {
		document.getElementById("answer").innerHTML = "Eww. Gross. Please leave.";
	    document.getElementById("answer").style.color = "#ff6500";		
	}  
	if (herAge.value > 75 && yourAge.value > 75) {
		document.getElementById("answer").innerHTML = "Let's pretend this never happened. And never talk about this again.";
	    document.getElementById("answer").style.color = "#ff6500";		
	} 
	if (herAge.value >= 100  && yourAge.value >= 100) {
		document.getElementById("answer").innerHTML = "His and Hers caskets are in your near future.";
	    document.getElementById("answer").style.color = "gray";		
	} 	
}	
              
            
!
999px

Console