Andrue
Andrue

Reputation: 707

Form in Table not displaying right

I'm a sophomore in high school and I'm taking web design. I taught myself HTML and basic CSS over the summer. This was beneficial because my web design teacher knows nothing about HTML, CSS, or JavaScript. We have to create a personal website and the teacher said I could do my church's site since I was already working on it.

The teacher is making us use stuff from the book that's been covered in the class. The book is out of date. It teaches frames/framesets, table layouts, and talks about compatibility for the waring Netscape and Internet Explorer. (I'm doing a real website. No frames whatsoever.)

I need to include a table in my website, but I have no need for one. I decided to try to put a form inside of a table. I put my form inside of a <tr> tag, but its not displaying right.

If y'all have any better table ideas, then I'm all ears.

http://www.gracepensacola.com

Upvotes: 0

Views: 108

Answers (2)

Andrue
Andrue

Reputation: 707

After searching through several pages on Google, I came across an example. I put the example in JsFiddle.

The <table> should be nested inside of the <form>.

http://jsfiddle.net/Wf33B/

<form method="post">
    <table>
        <tr>
            <td>
                <label for="username">Username:</label>
            </td>
            <td>
                <input type="text" name="username" id="username" />
            </td>
        </tr>
        <tr>
            <td>
                <label for="password">Password:</label>
            </td>
            <td>
                <input type="password" name="password" id="password" />
            </td>
        </tr>
        <tr>
            <td>
                <input type="submit" name="cancel" value="Cancel" />
            </td>
            <td>
                <input type="submit" name="send" value="Send" />
            </td>
        </tr>
    </table>
</form>

Upvotes: 0

Artyom Neustroev
Artyom Neustroev

Reputation: 8715

I guess putting a form into tr tag is not a valid HTML. What you need to do is something like this:

<table>
   <tr>
      <td>Put your form here</td>
   </tr>
</table>

Upvotes: 1

Related Questions