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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <div id="header"></div>

<h2>Material design form elements</h2>

<form>
  <div class="line-editable">
    <input placeholder="Input01 *" type="text" class="Field_Input" id="input01" name="input01" required />

    <label>
      <div>Input01 *</div>
    </label>
  </div>
  
  <div class="line-editable">
    <input placeholder="Input02" type="text" class="Field_Input" id="input02" name="input02" value="333 123456789" />

    <label>
      <div>Input02</div>
    </label>
  </div>
  
  <div class="line-editable">
    <select placeholder="Select01" class="Field_Input" id="select01" name="select01">
      <option value="" disabled selected style="display:none">Select01</option>
      <option value="Option #1">Option #1</option>
      <option value="Option #2">Option #2</option>
      <option value="Option #3">Option #3</option>
    </select>

    <label>
      <div>Select01</div>
    </label>
  </div>
  
  <div class="line-editable">
    <textarea placeholder="Textarea01" class="Field_Input" id="textarea01" name="textarea01"></textarea>

    <label>
      <div>Textarea01</div>
    </label>
  </div>
  
  <div style="margin-top:15px; text-align:left; max-width:350px; margin:auto;">
    <input type="checkbox" value="1" checked="checked" id="privacy" name="privacy" /> 
    <label for="privacy">Accetto la privacy policy</label>
  </div>
  
</form>

<div style="text-align: center;">
  <a href="http://www.giuseppegerbino.com">www.giuseppegerbino.com</a>
</div>
              
            
!

CSS

              
                // BASIC STYLE
body { font-family: Sans-serif; background-color: #F6F6F6; margin: 0; padding: 0; }
a { 
  color: @orange; text-decoration: none; border-bottom: 1px solid transparent; padding: 3px; .transition;
  &:hover { border-bottom: 1px solid @orange; }
}
#header {
  background-color: @orange;
  color: #FFF;
  height: 171px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  box-shadow: inset 0px 20px 0px rgba(150,50,30,0.2);
  z-index: -1;
}
form {
  position: relative;
  margin: 30px auto;
  width: 100%;
  max-width: 560px;
  border: 1px solid #DDD;
  border-radius: 4px;
  padding: 15px;
  padding-bottom: 30px;
  text-align: center;
  background-color: #FFF;
  box-shadow: 0px 1px 4px rgba(0,0,0,0.1);
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
}
h2 { 
  color: #FFF; 
  text-align: center; 
  font-weight: 400; 
  margin: 50px auto -15px auto;
  font-family: Open Sans;
  font-size: 30px;
  text-shadow: 1px 1px 0px rgba(60,10,10,0.1);
}
@orange: #F0932E;

// LESS MIXINS
.transition(@property: all; @duration: 0.2s; @timing: ease-in-out; @delay: 0s;) {
	transition:          @property @duration @timing @delay;
	-webkit-transition:  @property @duration @timing @delay;
	-moz-transition:     @property @duration @timing @delay;
	-ms-transition:      @property @duration @timing @delay;
	-o-transition:       @property @duration @timing @delay;
}
.transform(@string) {
	-webkit-transform: 	@string;
	-moz-transform: 		@string;
	-ms-transform: 			@string;
	-o-transform: 			@string;
	transform: 					@string;
}
.rotate(@deg: 180deg) {
	-webkit-transform:  rotate(@deg);
	-moz-transform: 		rotate(@deg);
	-ms-transform: 			rotate(@deg);
	-o-transform: 			rotate(@deg);
	transform: 				  rotate(@deg);
}
.translate (@x, @y:0) {
	-webkit-transform:	translate(@x, @y);
	-moz-transform:			translate(@x, @y);
	-ms-transform:			translate(@x, @y);
	-o-transform:				translate(@x, @y);
	transform:				  translate(@x, @y);
}
.row-height(@value) {
	height: 			@value;
	line-height: 	@value;
}
.radius (@value: 3px) {
	border-radius: 					@value;
	-webkit-border-radius: 	@value;
	-moz-border-radius: 		@value;
}
.box-shadow(@style: 3px 3px 0px; @color: #000; @alpha: 3%) {
	box-shadow: 				@style fade(@color, @alpha);
	-moz-box-shadow: 		@style fade(@color, @alpha);
	-webkit-box-shadow: @style fade(@color, @alpha);
}
.box-shadow-none {
	box-shadow: 				none;
	-moz-box-shadow: 		none;
	-webkit-box-shadow: none;
}

// MATERIAL DESIGN FORM STYLE
.Field_Input {
  width: 100%;
}
.line-editable {
  position: relative;
  //width: 100%;
  max-width: 350px;
  margin: 10px auto;
  z-index: 1;
  input, select, textarea {
    outline: none !important;
    .box-shadow-none;
    vertical-align: middle;
    text-align: left;
    font-size: 16px;
    color: #666;
    font-family: Sans-serif;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    .radius(0px);
    padding: 0px;
    margin: 22px auto 3px;
    .row-height(30px);
    border: 0;
    border-bottom: 1px solid #E2E3E4;
    background: -webkit-linear-gradient(bottom, @orange 50%, @orange 50%);
    background: linear-gradient(to top, @orange 50%, @orange 50%);
    background-position: left bottom;
    background-size: 0px 1px;
    background-repeat: no-repeat;
    .transition;
    &:-webkit-autofill {
      -webkit-text-fill-color: #666;
      -webkit-box-shadow: 0 30px 50px -15px white inset !important;
    }
    .line-placeholder {
      visibility: visible !important;
      display: block !important;
      line-height: 30px;
      margin: 0 !important;
      padding: 0 !important;
      color: #999;
      font-size: 12px;
      text-transform: uppercase;
      .transition;
    }
    &::-webkit-input-placeholder{ .line-placeholder; } 
    &:-ms-input-placeholder, &::-moz-placeholder, &:-moz-placeholder { .line-placeholder; }
    + label {
      display: block !important;
      opacity: 0;
      position: absolute; 
      top: 28px;
      left: 0px;
      font-size: 12px;
      color: #C5C6C8;
    }
    &:focus, &.hasValue {
      .line-placeholder-hasValue {
        visibility: visible !important;
        display: block !important;
        opacity: 0;
        font-size: 11px;
        .translate(@x:0px, @y:-20px);
      }
      &::-webkit-input-placeholder { .line-placeholder-hasValue; } 
      &:-ms-input-placeholder, &::-moz-placeholder, &:-moz-placeholder { .line-placeholder-hasValue; }
      + label { 
        font-size: 11px;
        top: 9px;
        display: block !important;
        opacity: 1;
      }
    }
    &:hover, &:focus {
      border-bottom-color: @orange;
    }
    &:focus {
      background-position: left bottom;
      background-size: 100% 1px;
      &::-webkit-input-placeholder { color: @orange; }
      + label { color: @orange; }
    }
  }
  select {
    color: #999;
    font-size: 12px;
    text-transform: uppercase;
    cursor: pointer;
    //text-indent: -1px;
    background-image: url('http://staging.siamosoci.com/download/MyTemplate/icon-dropdown.png');
    background-position: center right !important;
    background-size: 12px 12px !important;
    position: relative;
    &:focus {
      background-position: top right !important;
    }
    option, &.hasValue {
      font-size: 16px;
      color: #666;
      text-transform: lowercase;
      &:first-letter { text-transform: capitalize; }
    }
  }
  textarea {
    max-width: 100%;
    line-height: 125%;
    resize: vertical;
    transition-property: background, border, color, padding;
    &:focus, &.hasValue {
      height: 80px;
      padding: 4px 0px;
    }
  }
  label, .hasValue label {
    position: absolute; 
    top: 10px;
    left: 0px;
    text-transform: uppercase;
    font-size: 12px;
    color: #C5C6C8;
    width: 100%;
    display: none;
    text-align: left;
    .transition;
    z-index: -1;
    div {
      width: 100%;
      margin: auto;
    }
  }
}

input[type='checkbox'], input[type='radio'] {
  @border-color: #DDD;
  max-width: 100%;
  font-size: 14px;
  font-weight: normal;
  background-color: #FBFBFB;
  text-align: left;
  appearance: none;
  -moz-appearance: checkbox;
  -webkit-appearance: none;
  border-width: 1px;
  // border-top-width: 2px;
  border-style: solid;
  border-color: @border-color;
  .box-shadow(@style: inset 0 0 0; @color: #000; @alpha: 0%;);
	float: left;
	display: block;
	padding: 0;
	margin: 3px 8px 3px 0px;
	width: 20px !important;
	min-width: 20px;
	height: 20px !important;
	min-height: 20px;
	position: relative;
	outline: 0;
	white-space: normal;
	overflow: visible;
  outline: 0;
	opacity: 1;
	cursor: pointer;
  .radius;
  .transition;
  &:hover { border-color: @orange; }
  &:focus, &.focused { 
    background-color: #FDFDFD; 
    color: #333;
    .box-shadow(@style: inset 0 1px 1px; @color: #000; @alpha: 10%;);
  }
	&:before {
		content: "";
		position: absolute;
		top: 0;
		left: 0;
		margin: 0;
	}
	&:after {
		-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
		filter: alpha(opacity=0);
		opacity: 0;
		content: "•";
		width: 10px;
		height: 10px;
		line-height: 11px;
		background: @orange;
		display: block;
		.radius(99px);
		speak: none;
		margin: 4px;
		text-align: center;
		color: @orange;
		position: absolute;
		top: 0;
		left: 0;
	}
	&:hover:after {
		-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
		filter: alpha(opacity=30);
		opacity: 0.3;
	}
	&:checked:after {
		-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
		filter: alpha(opacity=100);
		opacity: 1;
	}
  & + label {
    display: inline-block;
    margin: 3px auto;
    color: #999;
    cursor: pointer;
    .row-height(21px);
  }
	&.inline { margin-top: 3px; margin-bottom: 3px; }
}
input[type='checkbox']:after {
	content: "\f00c";
  font: normal normal normal 14px/1 FontAwesome;
  font-size: inherit;
	width: 18px;
	.row-height(18px);
	background: url('/images/icon-check.png') center center no-repeat;
	margin: 0px;
  .transition;
}

//input[type="date"]::-webkit-inner-spin-button { display: none; } // DISABLE DATE INPUT ARROWS
              
            
!

JS

              
                var $formElements = $('input, textarea');
var $selects = $('select option:selected:not([disabled])').parent();
var $autofill = $('input:-webkit-autofill').length > 0;
		$formElements.add($selects, $autofill);

$formElements.each(function() {
    $selects.addClass('hasValue');
  if( this.value ) {
    $(this).addClass('hasValue');
  } else {
    $(this).removeClass('hasValue');
  }
});

$('input, select, textarea').on('load autocompletechange change', function() {
  if( this.value ) {
    $(this).addClass('hasValue');
  } else {
    $(this).removeClass('hasValue');
  }
});
              
            
!
999px

Console