Docsity

Creating and Formatting Tables: A Comprehensive Guide, Slides of Computer Programming

Partial preview of the text

Download Creating and Formatting Tables: A Comprehensive Guide and more Slides Computer Programming in PDF only on Docsity!

Tables And Lists

Lecture Overview

 Learn about the basics of tables  Create simple 2-dimensional tables  Format tables  Create tables with complex structures

Introduction to Tables (2)

 Much has changed from transitional to strict XHTML  I’ll use the new constructs in this lecture to support good habits  I spend quite a bit of time on this topic because tables are used so frequently

 In some cases, CSS has replaced tables

Basic Table Tags

 The **** tag is the outermost tag and marks the table  The border attribute defines the width of the border surrounding the table  The **** tag appears inside the **** tag and marks a table row  The **** tag appears inside the **** tag and marks the table data (cell)

Basic Table Tags (Example)

Tables (More Tags)

 The **** element appears as a child of a **** and contains the table’s title  It appears just above the table  The **** element is similar to the **** element but contains the table’s header  The header is typically emphasized

(Attributes)

 The border attribute defines the thickness of the table’s border  Value is measured in pixels  The cellpadding attribute defines the number of pixels from the cell wall to the cell content  The cellspacing attribute defines the number of pixels between cells

 We can also do this with CSS docsity.com

(Attributes)

Columns

 The **** tag appears as a child of the **** or **** tag and describes formatting for the entire column  It’s often easier than formatting individual rows or cells  The **** tag is used to apply formatting to several columns

Columns (Example)

 Center the data in the first column and right justify the second column

**

**

...

Cell Spanning (Example)

 Set Chapter6Table1Example.htm

Cell Spanning (Illustration)

Table Formatting and CSS

 We have not discussed CSS yet but I want to mention it here  Everything is a box in the eyes of CSS  A table is a box  A table row is a box  A table cell is a box  A nested table is just another box

Table Formatting and CSS

 Borderstyle is used to set the border of a cell, row or the table  All margin and padding works as you would expect