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
Soufiane Bdaoui
9,602 PointsI must use <p> or <ul> tag with forms?
It's better to put the <input> element inside a p or ul?
Soufiane Bdaoui
9,602 PointsThanks Frank, but what about input instead?
2 Answers

Jason Miller
11,311 PointsI'm unsure what you mean here but I think you are referring to how to mark up your individual form elements within a form. Both <p>
and <ul>
are commonly used by developers for this. Although I think using a <ul>
with <li>
for individual form elements is more semantic because you are essentially creating a list of form elements. For example, this would be the case with a contact form with a name, email address, phone number and enquiry field or almost any form for that matter. Using a <p>
element is more just for styling purposes because it is a block level element, which gives you a new line and default margin above and below each form element wrapped in a <p>
tag. You should use the most semantic element possible but that is not always so clear. My advice is to use the <ul>
with <li>
tags because it is the more semantic of the two in my opinion.
Soufiane Bdaoui
9,602 PointsThat is exactly what i needed, thanks!

Jason Miller
11,311 PointsNo problem Soufiane, glad I could help.

asmalushawo
6,292 PointsHi,
Try this:
<form>
<input type="text" name="name" placeholder="name" /> <input type="text" name="email" placeholder="email" disabled /> <div> <input name="radio" id="radio1" type="radio" /><label for="radio1">Option 1</label> <input name="radio" id="radio2" type="radio" /><label for="radio2">Option 2</label> <input name="radio" id="radio3" type="radio" /><label for="radio3">Option 3</label> </div> <input type="submit" name="submit" />
</form>
Frank Meza
8,393 PointsFrank Meza
8,393 PointsYou wouldn't use the
<p>
or<ul>
tags, just the<form>
tag alone, and you wouldn't put the<form>
inside of either of those.I hope that helps!