Skip to content

Instantly share code, notes, and snippets.

@hhypnos
Created January 30, 2016 20:27
Show Gist options
  • Save hhypnos/d3508f1d4bb1b04c03d4 to your computer and use it in GitHub Desktop.
Save hhypnos/d3508f1d4bb1b04c03d4 to your computer and use it in GitHub Desktop.
Contact Form Template

Contact Form Template

HTML/SCSS/JS Dynamic CSS classes for labels based on input field's value. pen by Chris Holder , i made it 3D

A Pen by GIO on CodePen.

License.

<section id="hire" class="container">
<h1>Contact Me</h1>
<form>
<div class="field name-box name">
<input type="text" id="name" placeholder="Who Are You?"/>
<label for="name">Name</label>
<span class="ss-icon">check</span>
</div>
<div class="field email-box email">
<input type="text" id="email" placeholder="[email protected]"/>
<label for="email">Email</label>
<span class="ss-icon">check</span>
</div>
<div class="field msg-box msg">
<textarea id="msg" rows="4" placeholder="Your message goes here..."/></textarea>
<label for="msg">Msg</label>
<span class="ss-icon">check</span>
</div>
<input class="button" type="submit" value="Send" />
</form>
</section>
//pen by Chris Holder , i made it 3D
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
body {
background: #efefef;
font-size: 62.5%;
font-family: 'Lato', sans-serif;
font-weight: 300;
color: #B6B6B6;
}
.container {
position: relative;
perspective: 1000px;
transform-style:preserve-3d;
}
body section {
background: white;
margin: 60px auto 120px;
border-top: 15px solid #313A3D;
text-align: center;
padding: 50px 0 110px;
width: 80%;
max-width: 1100px;
}
body section h1 {
margin-bottom: 40px;
font-size: 4em;
text-transform: uppercase;
font-family: 'Lato', sans-serif;
font-weight: 100;
}
form {
width: 58.33333%;
margin: 0 auto;
}
form .field {
width: 100%;
position: relative;
margin-bottom: 15px;
}
form .field label {
text-transform: uppercase;
position: absolute;
top: 0;
left: 0;
background: #313A3D;
width: 100%;
padding: 18px 0;
font-size: 1.45em;
letter-spacing: 0.075em;
-webkit-transition: all 333ms ease-in-out;
-moz-transition: all 333ms ease-in-out;
-o-transition: all 333ms ease-in-out;
-ms-transition: all 333ms ease-in-out;
transition: all 333ms ease-in-out;
}
form .field label + span {
font-family: 'SSStandard';
opacity: 0;
color: white;
display: block;
position: absolute;
top: 12px;
left: 7%;
font-size: 2.5em;
text-shadow: 1px 2px 0 #cd6302;
-webkit-transition: all 333ms ease-in-out;
-moz-transition: all 333ms ease-in-out;
-o-transition: all 333ms ease-in-out;
-ms-transition: all 333ms ease-in-out;
transition: all 333ms ease-in-out;
}
form .field input[type="text"],
form .field textarea {
border: none;
background: #E8E9EA;
width: 80.5%;
margin: 0;
padding: 18px 0;
padding-left: 19.5%;
color: #313A3D;
font-size: 1.4em;
letter-spacing: 0.05em;
text-transform: uppercase;
}
form .field input[type="text"]#msg,
form .field textarea#msg {
height: 18px;
resize: none;
-webkit-transition: all 333ms ease-in-out;
-moz-transition: all 333ms ease-in-out;
-o-transition: all 333ms ease-in-out;
-ms-transition: all 333ms ease-in-out;
transition: all 333ms ease-in-out;
}
form .field input[type="text"]:focus, form .field input[type="text"].focused,
form .field textarea:focus,
form .field textarea.focused {
outline: none;
}
form .field input[type="text"]:focus#msg, form .field input[type="text"].focused#msg,
form .field textarea:focus#msg,
form .field textarea.focused#msg {
padding-bottom: 150px;
}
form .field input[type="text"]:focus + label, form .field input[type="text"].focused + label,
form .field textarea:focus + label,
form .field textarea.focused + label {
width: 18%;
background: #FD9638;
color: #313A3D;
}
form .field input[type="text"].focused + label,
form .field textarea.focused + label {
color: #FD9638;
}
form .field:hover label {
width: 18%;
background: #313A3D;
color: white;
}
form input[type="submit"] {
background: #FD9638;
color: white;
-webkit-appearance: none;
border: none;
text-transform: uppercase;
position: relative;
padding: 13px 50px;
font-size: 1.4em;
letter-spacing: 0.1em;
font-family: 'Lato', sans-serif;
font-weight: 300;
-webkit-transition: all 333ms ease-in-out;
-moz-transition: all 333ms ease-in-out;
-o-transition: all 333ms ease-in-out;
-ms-transition: all 333ms ease-in-out;
transition: all 333ms ease-in-out;
}
form input[type="submit"]:hover {
background: #313A3D;
color: #FD9638;
}
form input[type="submit"]:focus {
outline: none;
background: #cd6302;
}
.name { transform: rotateY( 25deg ) translateZ( 150px ); }
.email { transform: rotateY( -25deg ) translateZ( 150px ); }
.msg:active { transform: rotateY( 0deg ) translateZ( 250px ); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment