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


Mark Lawson
Mark Lawson
6,148 Points

Contact Forms

I am just finishing off the CSS beginner courses. I want to build a simple contact form. Which is the best course for this??



1 Answer

Erik Nuber
Erik Nuber
20,629 Points

You will need to set up an html file that uses the <form> tag. Inside this, you can create <fieldset> tags to define sections of your form. <legend> tags are used to create header sections for your form and then you can use <label> and <input> tags to create the actual information for your contact form. <label> tags are used to tell the user what they will be putting into a given area and the corresponding <input> tag will be used for where they actually type. You tell the label it is for the given input by using "for" within the <label> and giving it the ID of the input field. This ties them together.

<label  for="name">*Name:</label>
 <input type="text" id="name" name="user_name" required>

As far as the CSS then goes, you have so many options. You can use the tags themselves or assign classes to various items in order to style them.

Depending on what you want to do with the form, you most likely will need some basic PHP. I have not taken those courses but, spent a little bit of time on google and was able to quickly put something together.

If this isn't what you were actually looking for, please let us know and I will try to help you further.