How to Set Table Column Attributes in HTML

By eHow Internet Editor

Rate: (0 Ratings)

Tables in HTML are used to provide a matrix of rows and columns, with each cell holding its own value. You can set certain formatting attributes for each column independently, such as alignment and width.

Instructions

Difficulty: Moderately Easy

Things You’ll Need:

  • Text file editor

Create the Table

Step1
Open the program with which you're editing your web page. Find the place you want to put the table, then click to insert your cursor.
Step2
Type the following: .
Step3
Replace the "1" with a number that indicates how thick you want the table's borders to be. Omit the "border" expression and number entirely if you want the borders to be invisible.

Set Formatting for a Column

Step1
Type the following by itself on the next line to indicate that you are setting attributes for the first column of the table:
Step2
Replace "3" with the number of columns that you want these attributes to apply to, counting from the leftmost unformatted column to the right. If you omit the span attribute, the formatting will apply to a single column.
Step3
Replace "right" with "left," "center" or "justify" to reflect the alignment you want the contents of the column to have.
Step4
Replace "top" with "bottom" or "center" to reflect the vertical alignment you want the contents of the column to have.
Step5
Replace "40" with a number that reflects how many pixels wide you want the column to be.
Step6
Write an additional column tag for each additional column in this table for which you want to set attributes. Each column tag operates on the next unformatted column, from left to right.

Finish the Table

Step1
Continue to create
and
tags to define the cells of the table once all your column groups have been defined.
Step2
Type
to complete the definition of the table.

Tips & Warnings

  • Column attributes can also be set with the tag.
  • Watch out for typos when creating HTML. If your code doesn't work, or if it shows up on your actual web page, you'll need to comb through your code to make sure all brackets and quotes are in the correct places.
  • Make sure to place the element right after the tag, before defining the table header or its rows.

    Post a Comment

    POST A COMMENT

    Request a New How-To Article

    Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

    eHow Article:  How to Set Table Column Attributes in HTML

    eHow Internet Editor

    eHow Internet Editor

    Category: Internet

    Articles: See my other articles

    Related Ads

    Internet

    Veesites
    Meet Virginia DeBolt eHow’s Internet Expert.