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

PHP Build a Simple PHP Application Adding a Contact Form Creating Input Fields

Shane Meikle
Shane Meikle
13,188 Points

Why use tables instead of CSS for the form field?

Is there an advantage to using a table instead of CSS in this instance? For example, I added the following to the given CSS file instead of using the table as explained in the video:

label {
    display: inline-block;
    width: 100px;
    text-align: right;
}

input {
    display: inline-block;
}

Was the table route done for simplicity or is there a performance/layout advantage that can be explained to me?

1 Answer

Gareth Borcherds
Gareth Borcherds
9,372 Points

Something tells me it was done out of simplicity. I like to avoid tables to do any normal styling. I would bet this is to not confuse people that haven't done anything with CSS that are doing the php class.

Shane Meikle
Shane Meikle
13,188 Points

Figured as much, thanks for the opinion.