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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <html>
  <head>
    <title>Music Survey</title>
  </head>
    <body id="body">
      <main id="main">
    <div id="img"><!--Adds image behind entire page-->
      <h1 id="title">Music Survey</h1>
      <p id="description">Thank you for taking the time to express your thoughts on music!</p>
      
      <form id="survey-form">
       
        <div>
        <label id="name-label" for="name">Name</label><br>
      <input id="name" type="name" name="name" placeholder="Enter your name" required><br><br>
        </div>
        
        <div>
        <label id="email-label" for="email">Email</label><br>
  <input id="email" type="email" name="email" placeholder="Enter your email" required><br><br>
        </div>
        
        <div>  
        <label id="number-label" for="number">Age (optional)</label><br>
        <input id="number" type="number" name="age" placeholder="Age" min="10" max="99"><br><br>
        </div>
        
        <div>
          <label for="dropdown"><p>How often do you listen to music a week?</p></label><br>
        <select id="dropdown" name="time-spent" required>
          <option value="none" selected disabled>Select one</option>
          <option value="<1 day a week"><1 day a week</option>
          <option value="1-2 days a week">1-2 days a week</option>
          <option value="3-5 days a week">3-5 days a week</option>
          <option value="7 days a week">7 days a week</option>
        </select><br>
        </div>
        
        <!--Involvement in music using radio buttons-->
        <div>
        <p id="option">Which option best describes your involvement in music?</p><br>
          <input id="low" type="radio" name="involvement" value="I only listen to it in the car or while I'm doing something else">
          <label for="low">I only listen to it in the car or while doing something else</label><br>
          <input id="medium" type="radio" name="involvement" value="I listen to it quite a bit and have studied music">
          <label for="medium">I listen to it quite a bit play one or more instruments</label><br>
          <input id="high" type="radio" name="involvement" value="I listen to it every day and play one or more instruments">
          <label for="high">I listen to it every day and study music</label>
        </div><br>
        
        <!--List of genres using checkbox-->
        <div id="fieldset">
          <fieldset>
            <legend>What genres of music do you like?</legend>
              <span>
           <div>
            <label for="genre-pop">
              <input id="genre-pop" type="checkbox" name="fav-genre" value="Pop">Pop
            </label> 
           </div>
              
           <div>
            <label for="genre-rock">
              <input id="genre-rock" type="checkbox" name="fav-genre" value="Rock">Rock
            </label>
           </div>
              
           <div>
            <label for="genre-country">
              <input id="genre-country" type="checkbox" name="fav-genre" value="Country">Country
            </label>
           </div>
              
           <div>
            <label for="genre-metal">
              <input id="genre-metal" type="checkbox" name="fav-genre" value="Metal">Metal
            </label>
           </div>
              
           <div>
            <label for="genre-rap">
              <input id="genre-rap" type="checkbox" name="fav-genre" value="Rap">Rap
            </label>
           </div>
              </span>
              
            <span>
           <div>
            <label for="genre-electronic">
              <input id="genre-electronic" type="checkbox" name="fav-genre" value="Electronic">Electronic
            </label>
           </div>
              
           <div>
            <label for="genre-gospel">
              <input id="genre-gospel" type="checkbox" name="fav-genre" value="Gospel">Gospel
            </label>
           </div>
              
           <div>
            <label for="genre-punk">
              <input id="genre-punk" type="checkbox" name="fav-genre" value="Punk">Punk
            </label>
           </div> 
              
           <div>
            <label>
              <input for="genre-reggae" type="checkbox" name="fav-genre" value="Reggae">Reggae
            </label>
           </div> 
              
           <div>   
            <label>
              <input for="genre-classical" type="checkbox" name="fav-genre" value="Classical">Classical
            </label>
              </div>
            </span>
          </fieldset>
        </div>
        
        <label for="comments"><p>Comments?</p></label>
        <textarea id="comments" name="comments" rows="10" cols="70">
        </textarea>
        
        <input id="submit" type="submit" value="submit">
      </form>
      
   </main>
  </body>
 </div>
</html>

              
            
!

CSS

              
                * { /*add properties to all elements*/
  color: whit;
  font-family: sans-serif, 'Times New Roman';
  font-variant: small-caps;
}

#main {
  width: 100%;
}

#img {
  background-image: url(http://www.allwhitebackground.com/images/6/Music-Background-Free-Picture.jpeg);
  background-attachment: fixed; /*Keeps the image from moving, but allows the rest of the page to move in front of it*/
  width: 100%; 
}

#title {
  font-style: italic;
  text-align: center;
  color: black;
  padding: 10px 0 0 0;
  margin: 0 0 10px 0;
}

#description {
  text-align: center;
  font-style: italic;
  color: black;
  font-size: large;
  padding: 0 0 10px 0;
  margin: 0 0 10px 0;
}

#survey-form {
  width: 50%;
  max-width: 30%; /*width of the page minus the padding*/
  max-height: 98%; /*height of page minus the padding*/
  padding: 1% 10% 1% 10%;
  margin: 0 25% 0 25%; /*moves the entire form*/
  background-color: rgb(9, 32, 74, 0.8);
  font-size: large;
  color: white;
}

input[type='name'] {
  width: 100%;
}

input[type='email'] {
  width: 100%;
}

input[type='number'] {
  width: 100%;
}

#name-label {
  font-weight: bold; 
  display: inline-block;
  margin: 0px 0px 5px 0px;
}

#email-label {
  font-weight: bold;
  display: inline-block;
  margin: 0px 0px 5px 0px;
}

#number-label {
  font-weight: bold;
  display: inline-block;
  margin: 0px 0px 5px 0px;
}

select {
  width: 101.5%;
}

label p {
  font-weight: bold;
  display: inline;
}

/*how often?*/
#dropdown {
  display: block;
}

#option {
  display: inline-block;
  margin: 0px 0px 5px 0px;
  font-weight: bold;
}

#fieldset {
  width: 100%;
  height: 100%;
  display: inline-block;
  margin-bottom: 1em;
}

legend {
  font-weight: bold;
}

fieldset span:nth-of-type(1) {
  float: left;
  padding: .5em 0em 0em 3em;
}

fieldset span:nth-of-type(2) {
  float: right;
  padding: .5em 3em 0 0;
}

label input[type="checkbox"] {
  margin: 1.3em;
}

#comments {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

#submit {
  width: 101.5%;
  height: 50px;
  background-color: white;
  margin: 10px 0 10px 0;
  font-size: large;
}

#submit:hover {
  background-color: #2353A5;
}
              
            
!

JS

              
                
              
            
!
999px

Console