Pen Settings

HTML

CSS

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

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

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

              
                <form action="#" class="form">
    <div class="form-group">
      <label for="name">Nombre *</label>
      <input type="text" class="form-input" id="name" placeholder="Introduce tu nombre" minlength="3" required>
    </div>
    <div class="form-group">
      <label for="surname">Apellidos</label>
      <input type="text" class="form-input" id="surname" placeholder="Introduce tus apellidos">
    </div>
    <div class="form-group">
      <label for="birthdate">Fecha de nacimiento *</label>
      <input type="text" class="form-input" id="birthdate" placeholder="Introduce tu fecha de nacimiento" aria-label="Utiliza el formato DD/MM/AAAA" title="Formato DD/MM/AAAA" pattern="^(0?[1-9]|[12]\d|3[01])[\/](0?[1-9]|1[0-2])[\/](19|20)\d{2}$" required>
    </div>
    <div class="form-group">
      <label for="email">Email *</label>
      <input type="email" class="form-input" id="email" placeholder="Introduce tu email" required>
    </div>
    <div class="form-group">
      <label for="favouriteNumber">Número favorito *</label>
      <input type="number" class="form-input" id="favouriteNumber" placeholder="Introduce tu número favorito" min="0" max="999" required>
    </div>
    <div class="form-group">
      <label for="comment">Comentario *</label>
      <textarea class="form-input form-input--textarea" id="comment" rows="3" placeholder="Deja tu comentario" required></textarea>
    </div>
    <div class="form-group form-group--submit">
      <button class="form-button" type="submit">Enviar</button>
    </div>
  </form>
              
            
!

CSS

              
                $c-white: #fff;
$c-black: #333;

$c-border: #e8e8e8;
$c-placeholder: #999;
$c-error: red;
$c-success: #2fe678;

$c-primary: #02ffd0;
$c-primary-hover: #80fee7;

* {
  box-sizing: border-box;
  font-family: Courier;
}

%formInput {
	display: block;
	width: 100%;
	height: 40px;
	border: 1px solid $c-border;
	border-radius: 4px;
	padding: 10px 16px;
	box-shadow: 1px 1px 2px 0 rgba($c-black, 0.2) inset;
	background-color: $c-white;
	background-clip: padding-box;
	color: $c-placeholder;
	font-size: 16px;
	font-weight: normal;
	transition: all 250ms;

	// Placeholder
	&::placeholder {
		color: $c-placeholder;
	}

	// Focus
	&:focus:required {
		border-color: $c-primary;
		outline: 0 none;
	}

	// States
	&:required:placeholder-shown {
		border: 1px solid $c-border;
	}
	&:required:not(:placeholder-shown):invalid {
		border: 1px solid $c-error;
		color: $c-error;
		box-shadow: 0 0 0 1px;
	}
	&:required:not(:placeholder-shown):valid {
		border: 1px solid $c-success;
		color: $c-success;
		box-shadow: 0 0 0 1px;    
	}
  &:required:focus:invalid {
		border: 1px solid $c-error;
		color: $c-error;
		box-shadow: 0 0 0 1px;
	}
}

.form {
  max-width: 30rem;
  margin: 2rem auto;
	&-group {
		margin-bottom: 24px;

		label {
			display: block;
			margin-bottom: 6px;
			font-weight: bold;
		}

		// MODIFIERS
		&--submit {
			display: flex;
			justify-content: flex-end;
		}
	}

	&-input {
		@extend %formInput;

		// Disabled
		&:disabled {
			opacity: 0.7;
			cursor: not-allowed;
		}
	}
  
  &-button {
    padding: 1.5rem 2rem;
    font-size: 1.125rem;
    cursor: pointer;
    background-color: $c-primary;
    border: 0;
    border-radius: 0.125rem;
    transition: background-color 300ms;
    
    &:hover, 
    &:focus {
      background-color: $c-primary-hover;
    } 
  }

	// MODIFIERS
	textarea {
		&.form-input {
			height: 20rem;
			resize: none;
		}
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console