cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              	<body id="contact" class="form">
	<div id="content">
<article>	   
			<header>
				  <h1>Form Examples</h1>
			</header>
			<p>A handful of form fields I like to demo for people.</p>
	<div class="notice failure" role="alert">
	<p>There were errors with your form submission:</p>
	<ol>
		<li><a href="#message">Message</a> is a required field</li>
		<li><a href="#name">Name</a> is a required field</li>
		<li><a href="#email">Email</a> is a required field</li>
	</ol>
</div>


			<form action="" accept-charset="utf-8" method="post">
				<fieldset>
					<ol>
						<li class="text">
							<label for="name">Your Name</label>
							<input id="name" name="name" required="" aria-required="true"/>
						</li>
						<li class="email">
							<label for="email">Your Email</label>
							<input type="email" id="email" name="email" required="" aria-required="true" aria-describedby="email-note">
							<em class="notes" id="email-note">We will only use your email address to respond to your message.</em>
						</li>
						<li class="select">
							<label for="subject">Purpose of Your Message</label>
							<select id="subject" name="recipient_email">
								<option>Question/Comment</option>
								<option>Article Error</option>
								<option>Website Bug Report</option>
								<option>Ask the Sherpas a question</option>
							</select>
						</li>
						<li class="textarea">
							<label for="message">Your Message</label>
							<textarea id="message" name="message" required="" aria-required="true"></textarea>
						</li>
            <li class="tel"><label for="preferred_phone">Preferred Phone</label>
<input type="tel" id="preferred_phone" name="preferred_phone"
			 placeholder="ex. 123-456-7890"
			 ></li>
<li class="url">
            <label for="url">URL</label>
<input type="url" id="url" name="url" required
			 aria-describedby="url-note"
			 >
<em class="note" id="url-note">
	Please provide the URL for the specific page that includes the area
	you want reviewed.
</em>
            </li>
										<li class="number">
<label for="captcha">1 + 1 = ?</label>
							<input type="number" id="captcha" name="captcha" required="" aria-required="true"/>
</li>
<li class="range">

							<label for="volume">How Loud is Spinal Tap?</label>
<input id="volume" type="range" name="volume" min="0" max="11" step="1">
</li>
            <li class="date"><label for="preferred_dates">Preferred Date to Visit</label>
<input id="preferred_dates" type="date" name="preferred_dates"
			 required
			 ></li>
            <li class="date"><label for="preferred_dates_2">Preferred Date to Visit</label>
<input id="preferred_dates_2" type="date" name="preferred_dates"
			 required
       min="2014-09-10" max="2014-12-19"
			 ></li>
            <li class="time"><label for="requested_tour_time">Tour Time Requested</label>
<input id="requested_tour_time" type="time" name="requested_tour_time">
							</li>            
            <li class="datalist"><label for="state">State</label>
<input id="state" name="state" list="states">
<datalist id="states">
	<option>Alabama</option> 
	<option>Alaska</option> 
	<option>Arizona</option> 
	<option>Arkansas</option>
</datalist></li>
            <li class="datalist datalist--alt"><label for="state" id="state_label">State</label>
<datalist id="states">

	<select name="state" aria-labelledby="state_label">
		<option>Alabama</option> 
		<option>Alaska</option> 
		<option>Arizona</option> 
		<option>Arkansas</option>
	</select>

	If other, please specify

</datalist>
              <input id="state" name="state" list="states"></li>
            <li class="confirm">	
	<label for="newsletter">
		<input type="checkbox" name="newsletter" value="yes"
					 id="newsletter"> Sign me up for this newsletter
	</label>
</li>
            <li class="grouped checkbox"><fieldset>
							<legend>Tablets 													<em>(9 available)</em></legend>
							<ul>
							
								<li>
									<label for="asus-nexus-7">
										<input type="checkbox" name="reservation_requested_device[]" id="asus-nexus-7" value="Asus Nexus 7 (Upper Cabinet #8)" data-checkbox-required="">
										Asus Nexus 7
									</label>
								</li>
							
								<li>
									<label for="nook-color">
										<input type="checkbox" name="reservation_requested_device[]" id="nook-color" value="Barnes &amp; Noble Nook Color (Upper Cabinet #2)" data-checkbox-required="">
										Barnes &amp; Noble Nook Color
									</label>
								</li>
							
								<li>
									<label for="blackberry-playbook">
										<input type="checkbox" name="reservation_requested_device[]" id="blackberry-playbook" value="BlackBerry Playbook (Upper Cabinet #1)" data-checkbox-required="">
										BlackBerry Playbook
									</label>
								</li>
							
								<li>
									<label for="datawind-ubislate-7cz">
										<input type="checkbox" name="reservation_requested_device[]" id="datawind-ubislate-7cz" value="Datawind UbiSlate 7cz (16)" data-checkbox-required="">
										Datawind UbiSlate 7cz
									</label>
								</li>
							
								<li>
									<label for="dell-streak-7">
										<input type="checkbox" name="reservation_requested_device[]" id="dell-streak-7" value="Dell Streak 7 (Upper Cabinet #7)" data-checkbox-required="">
										Dell Streak 7
									</label>
								</li>
							
								<li>
									<label for="ipad-2">
										<input type="checkbox" name="reservation_requested_device[]" id="ipad-2" value="iPad 2 (Upper Cabinet #15)" data-checkbox-required="">
										iPad 2
									</label>
								</li>
							
								<li>
									<label for="kindle-fire-1">
										<input type="checkbox" name="reservation_requested_device[]" id="kindle-fire-1" value="Kindle Fire (Upper Cabinet #5)" data-checkbox-required="">
										Kindle Fire
									</label>
								</li>
							
								<li>
									<label for="microsoft-surface-rt">
										<input type="checkbox" name="reservation_requested_device[]" id="microsoft-surface-rt" value="Microsoft Surface RT (Upper Cabinet #3)" data-checkbox-required="">
										Microsoft Surface RT
									</label>
								</li>
							
								<li>
									<label for="samsung-galaxy-tab-10">
										<input type="checkbox" name="reservation_requested_device[]" id="samsung-galaxy-tab-10" value="Samsung Galaxy Tab 10 (Upper Cabinet #4)" data-checkbox-required="">
										Samsung Galaxy Tab 10
									</label>
								</li>
							
							</ul>
						</fieldset></li>
<li class="group reservation-times">
					<fieldset>
						<legend>Requested Day and Time</legend>
						<label for="reservation_requested_date">Requested Day</label>
						<select name="reservation_requested_date" id="reservation_requested_date" required="">
						<option value="Monday, May 4, 2015">Monday, May 4</option><option value="Tuesday, May 5, 2015">Tuesday, May 5</option><option value="Wednesday, May 6, 2015">Wednesday, May 6</option><option value="Thursday, May 7, 2015">Thursday, May 7</option><option value="Friday, May 8, 2015">Friday, May 8</option><option value="Monday, May 11, 2015">Monday, May 11</option><option value="Tuesday, May 12, 2015">Tuesday, May 12</option><option value="Wednesday, May 13, 2015">Wednesday, May 13</option><option value="Thursday, May 14, 2015">Thursday, May 14</option><option value="Friday, May 15, 2015">Friday, May 15</option>						</select>
						<label for="reservation_requested_time">Requested Time</label>
						<select name="reservation_requested_time" id="reservation_requested_time" required="" aria-required="true">
							<option>10:00 AM</option>
							<option>10:30 AM</option>
							<option>11:00 AM</option>
							<option>11:30 AM</option>
							<option>1:00 PM</option>
							<option>1:30 PM</option>
							<option>2:00 PM</option>
							<option>2:30 PM</option>
							<option>3:00 PM</option>
							<option>3:30 PM</option>
							<option>4:00 PM</option>
						</select>
					</fieldset>
				</li>
            <li class="grouped year-month-day-selects">
	<fieldset>
		<legend id="select_date">Select a date</legend>

		<label for="month" id="month_label">Month</label>
		<select name="month" id="month"
						aria-labelledby="select_date month_label"
            ><option>January</option></select>
    <label for="day" id="day_label">Month</label>
<select name="day" id="day"
						aria-labelledby="select_date day_label"
            ><option>01</option></select>
    <label for="year" id="year_label">Year</label>
<select name="year" id="year"
						aria-labelledby="select_date year_label"
            ><option>2015</option></select>

	</fieldset>
</li>
            <li class="grouped table"><table>
	<thead>
		<tr>
			<td></td>
			<th>Poor</th>
      <th>Fair</th>
		      <th>Good</th>
		      <th>Great</th>
		      <th>Excellent</th>
		</tr>
	</thead>
	<tbody>
			<tr>
				<th>How would you rate your experience with Foo Bar Title 
					from initial contact to closing?</th>
				<td>
					<input type="radio" name="experience" value="1">
				</td>
								<td>
					<input type="radio" name="experience" value="2">
				</td>
								<td>
					<input type="radio" name="experience" value="3">
				</td>
								<td>
					<input type="radio" name="experience" value="4">
				</td>
								<td>
					<input type="radio" name="experience" value="5">
				</td>
				</tr>
	</tbody>
</table></li>
            <li class="text"><label for="test">Enter three numbers
	followed by two letters</label>
<input id="test" name="test"
			 placeholder="e.g. 123ab"
			 pattern="\d{3}[a-zA-Z]{2}"
			 ></li>
            <li class="text validation-error">
	<label for="email">Your Email <abbr title="required">*</abbr>
		</label>
	<input id="email" type="email" name="email" 
				 required="" aria-required="true"
				 aria-invalid="true" 
				 aria-describedby="email-error"
				 >
	<strong id="email-error" class="validation-error-message">
		Your email address is required</strong>
</li>
										<li class="buttons">
							<button type="submit">Send my message</button>
						</li>
            
					</ol>
          <p tabindex="0">Fields marked with a * are required.</p>
		
<p>
	<label for="first_name">
		First Name</abbr>
	</label>
	<input id="first_name" name="first_name" required
		aria-required="true">
</p>
		        </fieldset>
			</form>

		</article>

			
  </div>

</body>
            
          
!
            
              body {
  margin: 2em 1em;
  max-width: 39.625em;
}
article {
  margin: 0;
}
fieldset > ol > li {
  margin-bottom: 5em;
}
.form .confirm {
  padding-left: 0;
}
.note {
  display: block;
}
input, select, textarea {
  display: block;
  box-sizing: border-box;
  max-width: 87%
}
legend {
  box-sizing: border-box;
  display: block;
  font-family: Clarendon, Georgia, Times, "Times New Roman", serif;
  font-size: 1.143em;
  font-weight: bold;
  width: 100%;
  color: rgb(93, 42, 7);
  margin-bottom: 0.375em;
}
.form .grouped label {
  font-weight: normal;
  color: inherit;
  font-size: 1em;
}
.reservation-times fieldset label,
.year-month-day-selects fieldset label{
  position: absolute;
	height: 1px;
	width: 1px;
	overflow: hidden;
	clip: rect(1px 1px 1px 1px); /* IE6 & IE7 */
	clip: rect(1px, 1px, 1px, 1px);
}
.year-month-day-selects fieldset label + select,
.reservation-times label + select {
  display: block;
  margin-bottom: .75em;
  width: 100%;
}
@media only screen and (min-width: 30em){
  .reservation-times label + select,
  .year-month-day-selects fieldset label + select {
    display: inline;
    margin-bottom: 0;
    margin-right: .75em;
    width: auto;
  }
}
@media only screen and (min-width: 37.5em) {
  .grouped li {
    float: left;
    width: 50%;
    margin-bottom: .25em;
  }
  .group li:nth-child(2n+1) {
    clear: left;
  }
}
#content .table table {
  max-width: 44.714em;
}
.table td {
  text-align: center;
}
.table table,
.table td,
.table th {
  border: 0;
  background: transparent;
  color: inherit;
}
.table thead {
  border-bottom: 2px solid;
}
#content label input,
#content .table input {
  width: auto;
  display: inline-block;
}
.table td,
.table th {
  padding: 1em 1em 1em 0;
}
.validation-error-message {
  color: rgb(166, 52, 44);
  display: block;
}
.notice {
	border-radius: 10px;
	padding: 1.5em;
  margin: 0 0 5em;
}
.notice p {
	margin-bottom: .5em;
}
.notice ol {
	list-style-type: disc;
  padding-left: 1em;
}
.notice ol,
.notice li {
  margin-bottom: 0;	
  overflow: visible;
}
.notice a {
	text-decoration: underline;
}
.failure {
		background-color: rgb(169, 33, 31);
		border-color: rgb(131, 26, 24);
		color: rgb(255, 255, 255);
	}
	.failure a:link, .failure a:visited {
		color: inherit;
	}
.confirm label,
.radios label,
.checkboxes label {
	margin: -1em 0;
	padding: 1em 0;
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console