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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <svg style="display: none"><symbol id="star" viewBox="0 0 1024 1024"><polygon points="512 0 627 354 999 354 698 572 813 926 512 708 211 926 326 572 25 354 397 354 512 0"/></symbol></svg>

<div id="modal">
	<div class="overlay">
		<div class="feedback container--small align--center">
			<button id="close">Close</button>
			<h1 class="feedback__title">How did we do?</h1>
			<p class="feedback__description">Please let us know how your food delivery was. It will really help us to keep improving our service!</p>
			<form class="feedback__form">
				<fieldset class="rating rating__food">
					<legend>How would you rate your food?</legend>
					<div class="flex-container">
						<input type="radio" id="food-5" name="rating__food" value="5">
						<label for="food-5"><svg><title>Five Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="food-4" name="rating__food" value="4">
						<label for="food-4"><svg><title>Four Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="food-3" name="rating__food" value="3">
						<label for="food-3"><svg><title>Three Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="food-2" name="rating__food" value="2">
						<label for="food-2"><svg><title>Two Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="food-1" name="rating__food" value="1">
						<label for="food-1"><svg><title>One Star</title><use xlink:href="#star"></use></svg></label>
					</div>
				</fieldset>

				<fieldset class="rating rating__driver">
					<legend>How would you rate your delivery driver?</legend>
					<div class="flex-container">
						<input type="radio" id="driver-5" name="rating__driver" value="5">
						<label for="driver-5"><svg><title>Five Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="driver-4" name="rating__driver" value="4">
						<label for="driver-4"><svg><title>Four Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="driver-3" name="rating__driver" value="3">
						<label for="driver-3"><svg><title>Three Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="driver-2" name="rating__driver" value="2">
						<label for="driver-2"><svg><title>Two Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="driver-1" name="rating__driver" value="1">
						<label for="driver-1"><svg><title>One Star</title><use xlink:href="#star"></use></svg></label>
					</div>
				</fieldset>

				<fieldset class="rating rating__experience">
					<legend>How would you rate your overall experience?</legend>
					<div class="flex-container">
						<input type="radio" id="experience-5" name="rating__experience" value="5">
						<label for="experience-5"><svg><title>Five Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="experience-4" name="rating__experience" value="4">
						<label for="experience-4"><svg><title>Four Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="experience-3" name="rating__experience" value="3">
						<label for="experience-3"><svg><title>Three Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="experience-2" name="rating__experience" value="2">
						<label for="experience-2"><svg><title>Two Stars</title><use xlink:href="#star"></use></svg></label>
						<input type="radio" id="experience-1" name="rating__experience" value="1">
						<label for="experience-1"><svg><title>One Stars</title><use xlink:href="#star"></use></svg></label>
					</div>
				</fieldset>
			</form>
			<button type="submit" class="feedback__submit">Submit feedback</button>
		</div>
	</div>
</div>

              
            
!

CSS

              
                //Variables
$primary: #e75480;
$secondary: #e9967a;
$baseSpacing: 20px; 

//Helpers
html { box-sizing: border-box; }
*, *:before, *:after { box-sizing: inherit; }

#modal {
	position: relative;
	background: linear-gradient(150deg, $secondary, $primary);
	height: 100vh;
	text-align: center;
}

svg {
  max-width: 100%;
  max-height: 100%;
  fill: rgba(#000, 0.06%);
}

.flex-container {
	display: flex;
	flex-direction: row-reverse;
	flex-wrap: wrap;
	justify-content: center;
}

//Modal 
.overlay {
	position: fixed;
	width: 100%;
	height: 100%;
}

.feedback {
	position: relative;
	background-color: white;
	border-radius: 10px;
	padding: $baseSpacing $baseSpacing $baseSpacing*2;
	margin: $baseSpacing auto;
	max-width: 550px;
	
	&__content {
		padding: 0 $baseSpacing*2 $baseSpacing;
	}
	
	&__form {
		padding: $baseSpacing/2 0;
	}
	
	&__submit {
		background-color: $primary;
		padding: $baseSpacing/2 $baseSpacing*2;
		border: 0;
		color: #fff;
		letter-spacing: 1px;
		box-shadow: 0 2px 5px grey;
		cursor: pointer;
		transition: all .2s;
		
		&:hover {
			background-color: darken($primary, 10%);
		}
	}
}

.rating {
	margin-bottom: $baseSpacing;
	border: none;
	
	input {
		display: none;
		&:checked ~ label svg {
			fill: gold;
		}

		& + label:hover {
			svg,
			& ~ label svg {
				fill: gold;
			}
		}
	}
	
  label {
    position: relative;
		width: 2em;
  	height: 2em;
	}
}

#close {
	border: none;
	background: transparent;
	outline: none;
	position: absolute;
	right: $baseSpacing/2;
	top: $baseSpacing/2;
}

              
            
!

JS

              
                function sendFeedback() {
	const food = document.querySelector('input[name=rating__food]:checked');
	const driver = document.querySelector('input[name=rating__driver]:checked');
	const experience = document.querySelector('input[name=rating__experience]:checked');
	
	const feedback = { 
		food: checkValues(food), 
		driver: checkValues(driver), 
		experience: checkValues(experience) 
	};
	
	displayFeedback(JSON.stringify(feedback));
}

function checkValues(el) {
	if (!el) {
		return null;
	} else {
		return el.value; 
	}
}

function displayFeedback(msg) {
	const feedbackEl = document.createElement('pre');
	feedbackEl.insertAdjacentHTML('afterbegin', msg);
	document.querySelector('.feedback').append(feedbackEl);
}

document.querySelector('.feedback__submit').addEventListener('click', (e) => {
	e.preventDefault();
	sendFeedback();
});
              
            
!
999px

Console