Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

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??

Thanks

Mark

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.