1 / 5

How to create tables in HTML…

How to create tables in HTML…. To create an unusual table structure such as this one, how do you begin?. Tables are created row by row.

rune
Télécharger la présentation

How to create tables in HTML…

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to create tables in HTML… To create an unusual table structure such as this one, how do you begin? Tables are created row by row. For each row, cells are established moving from left to right, specifying in each <td> tag if a cell spans more than one column or row, using colspan and/or rowspan

  2. Let’s build the following table… Row 1 Row 2 Row 3 Row 4 The first step is to establish how many rows the table has? This table has 4 rows ! • The number of rows is NOT established by… • How many rows are in first column(This table does NOT have 2 rows) • The height of rows relative to each other(This table does NOT have 5 rows) Each row is separated by the upper and lower border of at least one cell in that row.

  3. Let’s build the following table… Row 1 Row 2 Row 3 Row 4 The first step is to establish how many rows the table has? This table has 4 rows ! One trick for identifying the number of rows is to draw lines down each of the possible columns, and find the line(s) that crosses the most number of cells. The number of cells crossed by this line(s) is how many rows the table has !

  4. Here’s the code… Row 1 Cell 1 Cell 3 Cell 2 Row 2 Cell 4 Cell 5 Cell 6 Row 3 Row 4 Cell 7 <table> <tr><!- - Row 1 - -> <tdcolspan=4> Cell 1 </td> </tr> <tr><!- - Row 2 - -> <tdrowspan=3width=20% > Cell 2 </td> <tdcolspan=3> Cell 3 </td> </tr> <tr><!- - Row 3 - -> <tdrowspan=2width=40%> Cell 4 </td> <td> Cell 5 </td> <td> Cell 6 </td> <tr> <tr> <!- - Row 4 - -> <tdcolspan=2> Cell 7 </td> </tr> </table>

  5. Some notes… Row 1 Cell 1 Cell 3 Cell 2 Row 2 Cell 4 Cell 5 Cell 6 Row 3 Row 4 Cell 7 Notice that Cell 2 is created in Row 2. Therefore, when Row 3 is being created, there does not need to be a <td> tag for cell 2 since it was already established Similarly, Cell 4 is created in Row 3. Therefore in Row 4, there are no <td> tags required for either Cell 2 or Cell 4 since they were both already established. Use the width attributes in the <td> tags to establish column widths, but only use the minimum number of width specifications necessary so as not to create conflict. The height attribute can also be used in <td> tags but you will find that its effectiveness is inconsistent.

More Related