Skip to main content

Learn HTML for beginner : Tables

There are a number of tags used in tables, and to fully get to grips with how they work is probably the most difficult area of this HTML Begin
ner Tutorial.
Copy the following code into the body of your document and then we will go through what each tag is doing:

<table>
    <tr>
        <td>Row 1, cell 1</td>
        <td>Row 1, cell 2</td>
        <td>Row 1, cell 3</td>
    </tr>
    <tr>
        <td>Row 2, cell 1</td>
        <td>Row 2, cell 2</td>
        <td>Row 2, cell 3</td>
    </tr>
    <tr>
        <td>Row 3, cell 1</td>
        <td>Row 3, cell 2</td>
        <td>Row 3, cell 3</td>
    </tr>
    <tr>
        <td>Row 4, cell 1</td>
        <td>Row 4, cell 2</td>
        <td>Row 4, cell 3</td>
    </tr>
</table>
The table element defines the table.
The tr element defines a table row.
The td element defines a data cell. These must be enclosed in tr tags, as shown above.
If you imagine a 3x4 table, which is 12 cells, there should be four tr elements to define the rows and three td elements within each of the rows, making a total of 12td elements.

Popular posts from this blog

learn html for intermediate : Definition Lists

The HTML Beginner Tutorial looked at unordered lists and ordered lists , but, much like Peter Cushing’s Doctor Who,  definition lists  are quite often forgotten. This is maybe because they are much more specific than ordered and unordered lists and therefore less useful, generally, but where there is a list of terms and descriptions (such as a glossary), a definition list is your go-to-element. dl  gets the ball rolling, similar to the  ul  and  ol elements, establishing the list. Rather than containing  li  elements, though, definition lists have  dt  elements, which are the  definition terms , followed by  dd  elements, which are definition descriptions  associated to the  dt elements. There doesn’t have to be one  dt  followed by one dd , there can be any number of either. For example, if there are a number of words that have the same meaning, there might be a number of  dt ’s followed by...

learn advanced html : Accessible Forms

Labels Each form field should have its own explicit label . The  label  tag sorts this out, with a  for attribute that associates it to a  form  element: < form > < label for = "yourName" > Your Name </ label > < input name = "yourName" id = "yourName" > <!-- etc. -->

learn advanced html Tables: Columns, Headers, and Footers

The Columns Strike Back Table rows tend to make table columns look rather stupid. They do all the work, as the table is built row by row, leaving the columns feeling quite rejected. Luckily for those eager columns though, the colgroup  and  col  tags have come to their rescue. These tags allow you to define the table columns and style them as desired, which is particularly useful if you want certain columns aligned or colored differently, as, without this, you would need to target individual cells.