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.


Demo from my article about the BEM Methodology.

Give this CodePen a ❤️ if you liked it and check out the article :)

<form class="default-form">
	<header class="default-form__form-title">
		<h1 class="default-form__form-title--main-title">Sign In</h1>
		<p class="default-form__form-title--subtitle">get an account, it's great!</p>
	<div class="default-form__form-main-area">
		<input class="default-form__input-box default-form__input-box--username" type="text" placeholder="Enter Username">
		<input class="default-form__input-box default-form__input-box--password" type="password" placeholder="Enter Password">
		<input class="default-form__submit-button" type="button" value="Sign In!">



Things to take note of:

 - The Block, Element, Modifier (block__element--modifier) structure of the classnames
 - The single-class CSS specificity (selectors are just the class, nothing else apart from pseudo-class if relevant) with just the BEM class
 - The multiple classes for modifiers &mdash; some elements have two classes, block__element, and then block__element--modifier
 - Elements are not nested in BEM; nested element classes do not include the parent element, just the block


* {
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
	color: #222222;

.default-form {
	display: block;
	position: absolute;
	top: 40%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 22.5rem;
	padding: 2.5rem;
	box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, .2);
	border-radius: 3px;

.default-form__form-title {
	display: block;
	margin-bottom: 2rem;

.default-form__form-title--main-title {
	font-size: 2.5rem;
	text-align: center;

.default-form__form-title--subtitle {
	font-size: 1.125rem;
	text-align: center;
	opacity: 0.75;
	margin-top: .5rem;

.default-form__input-box, .default-form__submit-button {
	font-size: 1.125rem;
	padding: .5rem .75rem;
	border: 1px solid #ccc;
	border-radius: 3px;
	display: block;
	margin: 0 auto;
	width: 15rem;
  box-sizing: border-box;

.default-form__input-box::placeholder {
	opacity: .65;

.default-form__input-box:not(:last-child), .default-form__submit-button:not(:last-child) {
	margin-bottom: .75rem;

.default-form__submit-button {
	color: #444;
	background-color: #f0f0f0;