How HTML table tags are used

Source: Internet
Author: User

  • Sampdoria
  • Italy
  • England
  • Spain
  • AC Milan
  • Florence
  • Manchester United
  • Newcastle
  • Barcelona
  • Royal Society
  • Juventus
  • Liverpool
  • Ashenna
  • Real Madrid
  • ...
  • Lazio
  • Inter
  • Chelsea
  • Middlesbrough
    • Atletico Madrid
    • ...

    1.<table></table>

    2.<tr></tr><td></td>

    3.<th></th>

    Table tags are important for making pages, and I want you to remember that many many pages use multiple tables, mainly because tables can not only fix the output of text or images, but also set background and foreground colors arbitrarily. I hope you can also use the table to make your homepage

    。

    1.<table></table>

    <table></table> label pairs are used to create a table. It has the following properties: Property purpose

    <table bgcolor= "" > Sets the background color of the table.

    <table border= "" > Set the width of the border, if this property is not set, the border width defaults to 0.

    <table bordercolor= "" > Sets the color of the border.

    <table bordercolorlight= > sets the color of the bright part of the border (useful when the value of border is greater than or equal to 1 o'clock).

    <table bordercolordark= > sets the color of the dim portion of the border (useful when the border value is greater than or equal to 1 o'clock).

    <table cellspacing= "" > Set the size of space between table lattices.

    <table cellpadding= > sets the size of the space between the table grid border and its inner content.

    <table width= "" > Set the width of the table, in absolute pixel values or as a percentage of the total width.

    Description: These properties can be used in combination. Absolute pixel values for units of width and size. Properties about colors use hexadecimal RGB color codes or color constant names given in the HTML language (such as Silver silver)

    2.<tr></tr><td></td>

    <tr></tr> label pairs are used to create each row in the table. This label pair can only be used between the <table></table> label pairs, and adding text between the tags will be useless, because you can only follow <td></td between <tr></tr> > Label pair is the valid syntax,<td></td> label pairs are used to create each grid in a row in a table, and this label is valid only between <tr></tr> label pairs, and the text you want to enter is only placed in the <td></td> tag pair is valid (that is, it can be displayed). The relationship between the <table></table>, <tr></tr> and <td></td> label pairs is as follows:

    <table> outermost, create a table

    <tr> Create a row

    <td> the text to be exported can only be placed here </td> create a cell (three cells are created altogether)

    <td> the text to be exported can only be placed here </td>

    <td> the text to be exported can only be placed here </td>

    </tr>

    The outermost layer of </table>

    In addition,,<tr> also has align and valign properties. Align is the horizontal alignment, the value is left (aligned), Center (center), right (right-aligned), and valign is a vertical alignment, with a value of top (aligned to align), Middle (Center-aligned), or bottom (bottom-aligned). <td> has a width, colspan, rowspan, and NoWrap properties. Width is the size of the lattice, percentage of absolute pixel value or total width of the unit; colspan sets the number of columns (the default is 1) for a grid span, and rowspan sets the number of rows spanned by a grid (the default is 1), and nowrap prevents the contents of the table grid from breaking automatically.

    3.<th></th>

    <th></th> label pairs are used to set the table header, which is usually centered in bold text.

    Take a look at the example below to understand the use of the above label.

    Example 6 A comprehensive sample of tabular labels

    <title> A comprehensive example of a table tag </title>

    <body>

    <table border= "1" width= "50%" bgcolor= "#E8E8E8" cellpadding= "2" bordercolor= "#0000FF"

    bordercolorlight= "#7D7DFF" bordercolordark= "#0000A0" >

    <tr>

    <th width= "33%" colspan= "2" valign= "bottom" > Italy </th>

    <th width= "36%" colspan= "2" valign= "bottom" > England </th>

    <th width= "36%" colspan= "2" valign= "bottom" > Spain </th>

    </tr>

    <tr>

    <TD width= "16%" align= "center" >AC Milan </td>

    <TD width= "16%" align= "center" > Florence </td>

    <TD width= "17%" align= "center" > Manchester United </td>

    <TD width= "17%" align= "center" > Newcastle </td>

    <TD width= "17%" align= "center" > Barcelona </td>

    <TD width= "17%" align= "Center" > Royal Society </td>

    </tr>

    <tr>

    <TD width= "16%" align= "center" > Juventus </td>

    <TD width= "16%" align= "center" > Sampdoria </td>

    <TD width= "17%" align= "center" > Liverpool </td>

    <TD width= "17%" align= "center" > Ashenna </td>

    <TD width= "17%" align= "center" > Real Madrid </td>

    <TD width= "17%" align= "center" >......</td>

    </tr>

    <tr>

    <TD width= "16%" align= "center" > Lazio </td>

    <TD width= "16%" align= "Center" > Inter </td>

    <TD width= "17%" align= "center" > Chelsea </td>

    <TD width= "17%" align= "center" > Middlesbrough </td>

    <TD width= "17%" align= "center" > Atletico Madrid </td>

    <TD width= "17%" align= "center" >......</td>

    </tr>

    </table>

    </body>

    The results shown in this example in the browser are as follows:

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.