Pen Settings



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


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


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.


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 lang="en">
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="preconnect" href="" />
		<link rel="preconnect" href="" crossorigin />
		<link rel="stylesheet" href="styles.css" />
		<script src="main.js" defer></script>
		<title>Chuck Norris Valentine's Day card 2</title>
		<div id="container">
      <label for="category">Select your category</label>
      <select name="category" id="category" disabled>
			<button onclick="fetchJoke()">Get a new category joke! 💘</button>
			<h3 id="title">Happy Valentine's Day from Chuck Norris!</h3>
			<div class="card">
					style="width: 100%"
			<p id="display-joke"
				>A Chuck Norris movie will touch your heart. Then it will rip it out of
				your chest!</p
			> </div
		><!-- container -->


                body {
	color: white;
	font-family: "Berkshire Swash", cursive;

button {
	background-color: pink;
	border-radius: 25px;

button:hover {
	background-color: white;
	cursor: pointer;

img {
	max-width: 150px;
	border: 3px dotted darkred;

select {
  margin-bottom: 5px;

#container {
	width: 300px;
	text-align: center;
	margin: 0 auto;
	padding: 25px;
	background: url("");
	background-repeat: no-repeat;
	box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.5);

label {
	text-shadow: -1px -1px 3px red, 1px 2px 1px black;
	padding: 5px;
	width: 100%;

#display-joke {
	background: rgba(0, 0, 0, 0.8);
	background-color: whitesmoke;
	color: black;
	text-shadow: 1px 1px 1px rgba(255, 0, 0, 0.9);
	padding: 25px;



const displayJoke = document.getElementById("display-joke");
const category = document.getElementById("category");
let chosenCategory = `dev`;

category.addEventListener("change", () => {
	chosenCategory = category.value;

async function generateCategoryOptions() {
	let outPut = ``;

	try {
		const results = await fetch(``);

		if (!results.ok) {
			throw new Error("Request failed.");

		const data = await results.json();


		data.forEach((category) => {
			outPut += `<option value="${category}">${category}</option>`;

		category.innerHTML = outPut;
		category[3].selected = true;
	} catch {

async function fetchJoke() {
	const errorMessage = `"DO NOT DISTURB!" Chuck Norris is currently entertaining guests in his hotel room.`;

	try {
		const results = await fetch(

		if (!results.ok) {
			displayJoke.textContent = errorMessage;
			throw new Error("Request failed.");

		const data = await results.json();
		displayJoke.textContent = data.value;
	} catch (error) {
		displayJoke.textContent = errorMessage;