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

              
                <main id="main" class="content">
  <div id="img-div">
    <figure>
      <a href="https://www.youtube.com/watch?v=dPOyOM7wxlE" target="_blank">
        <img id="image"
          src="http://images.fanpop.com/images/image_uploads/Bridge-of-Death-monty-python-and-the-holy-grail-591679_800_441.jpg"
          alt="A still from the Bridge of Death scene in Monty Python and The Holy Grail" />
      </a>
      <figcaption id="img-caption">Monty Python and The Holy Grail: Bridge of Death
        (<a href="https://www.youtube.com/watch?v=dPOyOM7wxlE" target="_blank">YouTube</a>). Source:
        <a href="http://www.fanpop.com/clubs/monty-python-and-the-holy-grail/images/591679/title/bridge-death-screencap"
        target="_blank">Fanpop</a>.
      </figcaption>
    </figure>
  </div>
  <div class="text">
    <h1 id="title">Bridge of Death</h1>
    <h2>Immigration and Customs Enforcement</h2>
    <p id="description"><strong>Stop!</strong> Who would cross the Bridge of Death must answer me these questions three (or more), 'ere the other side he see.</p>
    <p class="note">Items indicated by <span class="required">*</span> are required.</p>
      <form id="survey-form" class="survey" action="submit.html" method="get">
        <label id="name-label" class="field" for="name">What is your name? <span class="required">*</span></label>
        <input id="name" name="name" type="text" placeholder="Sir Launcelot of Camelot" required />
        <label id="email-label" class="field" for="email">What is your email address? <span class="required">*</span></label>
        <input id="email" name="email" type="email" placeholder="launcelot@roundtable.org.uk" required />
        <label id="occupation-label" class="field" for="occupation">What is your occupation?</label>
        <div id="occupation" class="checkboxes">
          <label for="occupation-1" class="checkbox"><input id="occupation-1" type="checkbox" name="occupation" value="King"> King</label>
          <label for="occupation-2" class="checkbox"><input id="occupation-2" type="checkbox" name="occupation" value="Knight"> Knight</label>
          <label for="occupation-3" class="checkbox"><input id="occupation-3" type="checkbox" name="occupation" value="Peasant"> Peasant</label>
          <label for="occupation-4" class="checkbox"><input id="occupation-4" type="checkbox" name="occupation" value="Police Officer"> Police Officer</label>
        </div>
        <label id="oppress-label" class="field" for="oppressed">Is the king oppressing you?</label>
        <div class="radio-buttons">
          <label for="oppressed-yes"><input id="occupation-yes" name="oppressed" type="radio" value="yes" /> Yes</label>
          <label for="oppressed-no"><input id="occupation-no" name="oppressed" type="radio" value="no" /> No</label>
        </div>
        <label id="dropdown-label" class="field" for="dropdown">What is your quest? <span class="required">*</span></label>
        <div class="dropdown">
          <div class="dropdown-options">
            <select id="dropdown" name="quest" class="select-box" required>
              <option value="">None of your business</option>
              <option value="grail">Search for the Holy Grail</option>
              <option value="defeat">Defeat the Black Knight</option>
              <option value="cross">Cross the Bridge of Death</option>
              <option value="rabbit">Lob the Holy Hand Grenade at the Rabbit of Caerbannog</option>
              <option value="other">Other (please specify)</option>
            </select>
          </div>
        </div>
        <label id="other-label" class="field" for="name">If you chose “Other”, briefly describe your quest:</label>
        <input id="other" name="quest-other" type="text" placeholder="I just want to sing" />
        <label id="number-label" class="field" for="number">What is the air-speed velocity of an unladen swallow (in km/h)? <span class="required">*</span></label>
        <input id="number" name="velocity" type="number" placeholder="60" min="0" max="200" required />
        <label id="comments-label" class="field" for="comments">Do you have any other comments before your fate is decided?</label>
        <textarea id="comments" name="comments" rows="6" placeholder="My favourite colour is red. No, blue."></textarea>
        <button id="submit" type="submit">Submit</button>
      </form>
    </div>
  </div>
</main>

              
            
!

CSS

              
                body {
  font: 1rem/1.5rem 'Open Sans', sans-serif;
  color: #333;
  margin: 0;
  padding: 0;
}

a:active,
a:visited,
a:link {
  text-decoration: none;
  color: #00f;
}
a:hover {
  color: #000;
}

div {
  box-sizing: border-box;
}

h1 {
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  font-size: 2em;
  line-height: 1.3em;
  color: #131313;
  margin-bottom: 0;
}

h2 {
  font-weight: normal;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-top: .5em;
}

figure {
  margin: 0;
}

figcaption {
  font-size: .7em;
  line-height: 1.3em;
  padding: .5em 0;
}

#image {
  width: 100%;
  max-width: 100%;
  display: block;
}

#img-caption {
  padding: .5em 1em;
}

.inset img {
  width: 100%;
}

.content {
  padding: 0;
  margin: 0;
  background: #fff;
}

.text {
  padding: .5em 2em 1.5em;
  box-sizing: border-box;
}

.note {
  font-size: .9em;
  font-style: italic;
}

.required {
  color: #f00;
}

aside p {
  font-size: .9em;
  border-top: 1px solid #eee;
  padding: .5em 0 .6em;
  margin: 0;
}

aside {
  border-bottom: 1px solid #eee;
}

::placeholder {
  color: #ccc;
}

input,
select,
textarea {
  box-sizing: padding-box;
}

textarea,
input[type="text"],
input[type="email"],
input[type="number"] {
  color: black;
  font-size: 1em;
  line-height: 1.5em;
  width: 100%;
  box-sizing: border-box;
  padding: .75em;
  margin: .5em 0 1em;
  border: 1px solid #ccc;
}

select {
  background: #fff;
  width: 100%;
  font-size: 1em;
  padding: 1em .75em;
  border: 1px solid #ccc;
  border-radius: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-overflow: '';
}

.dropdown {
  position: relative;
  margin: .5em 0 2em;
}

.dropdown .dropdown-options::after {
  color: #999;
  display: block;
  background: white;
  padding: .5em .3em .4em .8em;
  font-family: "Octicons";
  content: "\f0a3";
  font-size: 1.3em;
  pointer-events: none;
  position: absolute;
  top: .2em;
  right: .2em;
  border-left: 1px solid #eee;
}

label.field {
  font-weight: 700;
  display: block;
  margin-top: .75em;
}

form.submitted input:valid,
form.submitted select:valid,
form.submitted textarea:valid {
  border: 1px solid #ccc;
}

form.submitted input:invalid,
form.submitted select:invalid,
form.submitted textarea:invalid {
  border: 1px solid #f00;
  box-shadow: 0 0 0 2px #f00;
}

.checkboxes,
.radio-buttons {
  margin: .5em 0 1.5em;
}

.checkboxes label,
.radio-buttons label {
  margin-bottom: .5em;
  display: block;
}

button {
  font-size: 1em;
  text-transform: uppercase;
  color: #fff;
  background: #444;
  width: 100%;
  margin: .5em 0 1em;
  padding: 1em .75em;
  border: 1px solid #ccc;
  border-radius: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
}

button:hover {
  background: #000;
}

button:active {
  background: #0ac;
}

@media (min-width: 800px) {

  body {
    background: #ccc url('http://images.fanpop.com/images/image_uploads/Bridge-of-Death-monty-python-and-the-holy-grail-591679_800_441.jpg') no-repeat right top fixed;
    background-color: rgba(255, 255, 255, 0.50);
    background-blend-mode: color;
    background-size: cover;
  }

  h1 {
    font-size: 3em;
  }

  .text h1 {
    margin-top: 0;
  }

  figure.inset {
    float: left;
    width: 45%;
    display: inline;
    margin-right: 5%;
    margin-bottom: 1em;
  }

  .content {
    max-width: 800px;
    margin: 100px auto;
    box-shadow: 0 0 10px #888;
    border-top: 12px solid #131313;
  }

  .content:after {
    content: "";
    display: table;
    clear: both;
  }

  .text {
    padding: 5em 6em 6em;
  }

  .checkboxes label,
  .radio-buttons label {
    margin: 0 1em .5em 0;
    display: inline;
  }

}

              
            
!

JS

              
                document.getElementById("submit").addEventListener("click", function( event ) {
  document.getElementById("survey-form").classList.add("submitted");
});

              
            
!
999px

Console