Navy SEALs
SEAL Pics
SEAL Info
SEAL Training
Computer Programming
HTML
Cascading Style Sheets
Hall Of Fame
Programming Books
Free Downloads
Other Areas
Cool Links
Sign/View My Guestbook
Site Map
About The Webmaster
Main Page

Free Magazine

Chapter 3


  Preview
This chapter will cover more advanced topics of HTML. I won't cover nearly everything about forms and tables, I will go over the basic ideas. For full knowledge on these, definitely get a book.



  Lesson
Tables
Tables are quite easy to make when you get the hang of it. The basic outline for a table is as follows.
<table>
<tr><td>Cell 1</td><td>Cell 2</td></tr>
</table>
Which would create a table that looks like this.

Cell 1Cell 2

The elements in a table are the main <table> tag, the table row (<tr>) element, and the table data (<td>) element. Though the <td> tag doesn't need an end tag, since the next <td> tag will end it, sometimes it is good to use it. To create multiple rows for a table, simply put an end table row tag (</tr>) and start up a new row using the <tr> element.

But, as you can see, it doesn't look much like a table. That's because there aren't any rules or borders. This entire page is one big table, with the navigation bar, main page, and the extra space being the cells. So, as you can see, not all tables look like tables. If you add the attributes rules and border, then you can make it look better.
<table rules="all" border="1">
<tr><td>Cell 1</td><td>Cell 2</td></tr>
</table>
Which would then make this modified table.

Cell 1Cell 2

Now, the cells are seperated, which looks a lot nicer. Then, you can set cellspacing and cellpadding attributes to the table element, and seperate the cells more and the content in the cells from the borders of the cells. Here is how that works.
<table rules="all" border="1" cellspacing="3" cellpadding="5">
<tr><td>Cell 1</td><td>Cell 2</td></tr>
</table>
The code would render this final modified table.

Cell 1Cell 2

The cellpadding attribute is nice if you don't want the content crowding the borders of the cell. And the cellspacing attribute comes in usful if you want space between cells of a table. That is the basics of a table.



Forms
Forms are the most complex objects in HTML, since there are so many elements inside a form. Since there are so many, I won't even cover them, just the ideas behind forms.

Forms are used to create submittable objects, so that visitors could submit information to the webmaster. Though they have evolved into complex objects that can even be used for shopping and such items, they still hold the same basic idea. The form is filled out, then the user presses submit. Then, an application (be it a mail provider, a CGI or Perl script, or another appliction) proccess the information and either e-mails it somewhere, saves it to a file, or does some kind of proccessing like that. Then, the webmaster or whoever deals with the information takes action. This be anything from changing a single spelling error on their page, to selling a million dollors in products.

That is how forms work, and if you want to learn how to use them, I suggest getting Instant HTML 4.0 by Wrox Press.


Previous Chapter Next Chapter