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.


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.


                <div class="render-container">
	<div class="sizeScore">
		<span class="js-width">0px</span> X <span class="js-height">0px</span>
	<img class="render-image js-render-image" src="" />
	<img class="brand" src="" />


                .render-image {
	display: block;
	margin: auto;
.render-container {
	width: 100%;
	position: relative;
body {
	margin: 0;
	padding: 0;
.sizeScore {
	position: absolute;
	top: 0px;
	left: 0px;
	background-color: black;
	opacity: 0.5;
	color: aqua;
	padding: 0.5em;
	font-family: sans-serif;
	letter-spacing: 0.1em;
	position: absolute;
	top: -25px;
	right: 5px;



                (function($) {
	function calIamgeSize(imageSelector, imageOriginWidth, imageOriginHeight) {
		// make image as big as it can to start

		// Get the one percent of the image width and height
		var widthOnePercent = imageOriginWidth / 100;
		var heightOnePercent = imageOriginHeight / 100;

		// Calculate the width percentage
		var imageCurrentWidth = $(imageSelector).width();
		var imageCurrentPercent = imageCurrentWidth / widthOnePercent;

		// Calculate the height relative to the percentage of the images width
		var imageNewHeight = heightOnePercent * imageCurrentPercent;

		// If the images height is off the page, then rescale
		if ($(window).height() < $(imageSelector).offset().top + imageNewHeight) {
			// Set the new height so it fit on the screen
			imageNewHeight = $(window).height() - $(imageSelector).offset().top;

			// Calculate out what percentage is the height at
			imageCurrentPercent = imageNewHeight / heightOnePercent;

			// Calculate the width relative to the percentage of the images height
			var imageNewWidth = widthOnePercent * imageCurrentPercent;

			// Set new width of image

		// set new height of image

	// Resize image
	var imageW = 1000;
	var imageH = 667;
	var imageClass = ".js-render-image";
	$(window).on("resize", function() {
		calIamgeSize(imageClass, imageW, imageH);
	calIamgeSize(imageClass, imageW, imageH);

	function sizes() {
		$(".js-width").text(Math.ceil($(".js-render-image").width()) + "px");
		$(".js-height").text(Math.ceil($(".js-render-image").height()) + "px");