Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Vertical-align

I am trying to center the text in the middle. I tried line-height which came out with real bug. I also tried vertical-align:middle but nothing happens. What am i missing in my code and here is the screen short of my form https://gyazo.com/06f9bf4b635dc2eb210eed46010ef013

    <form method="#" action="#" id="contact-form">
    <fieldset>
     <legend>Don't Be Shy Just Say Hi To Me</legend>
              <p>
             <label for="firstName">First Name</label>
              <input type="text" name="first-name" placeholder="John" id="firstName">
              </p>
              <p>
                <label for="lastName">Last Name</label>
                <input type="text" name="last-name" placeholder="David" id="lastName">
              </p>

               <p>
                 <label for="email">Email</label>
                  <input type="emial" placeholder="JohnDavid@.com" id="email">
               </p>

               <p>
                <label for="Phone">Phone</label>
                 <input type="tel" id="Phone" name="phone-number" placeholder="900-285-7980">
               </p>
                <textarea name="message" id="message" placeholder="Hi there!"></textarea>

                <input type="submit" name="send" id="sendMessage" value="Send">

            </fieldset>
    </form>

Css styling here

*{box-sizing:border-box;}

  label {
    float:left;
    text-align:right;
    width:100px;
    margin-right:15px;
    font-weight:bold;
    color:red;
    vertical-align:middle;
    clear:both;
    /*display:inline-block;*/
}


#contact-form {
    margin:0 auto;
     width:650px;
}

/*When using the input[type] is important to keep them close together in order for it to work*/
#contact-form input[type=text], 
#contact-form input[type=emial],
#contact-form input[type=tel] {
     width:300px;
     margin-bottom:8px;
     border-radius:5px;
     border:1px solid #ccc;
     padding:10px 15px;
}


#contact-form input[type=tel] {
    width:150px;
}

#contact-form input[type=submit] {
     display:block; // push the submit button nav-down
     float:right;

}

#contact-form textarea {
     width:600px;
     height:300px;
     resize:none;
     border:3px solid #ccc;
     border-radius:5px;
     color:lightblue;
}


#contact-form fieldset {
    width:650px;
    border:none;
}

2 Answers

You can add padding to the label element. jsFiddle: Demo

I hope this helps.

Thank again bro

Anytime!