Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tables 23 rd February. What XHTML have we done so far? Hyperlinks & anchors - XHTML supports 3 types of lists:  Ordered – +  Unordered – +  Definition.

Similar presentations


Presentation on theme: "Tables 23 rd February. What XHTML have we done so far? Hyperlinks & anchors - XHTML supports 3 types of lists:  Ordered – +  Unordered – +  Definition."— Presentation transcript:

1 Tables 23 rd February

2 What XHTML have we done so far? Hyperlinks & anchors - XHTML supports 3 types of lists:  Ordered – +  Unordered – +  Definition – + + Using images - Using image maps -,,

3 Tables Table structure and variables Table layout and design Using tables Table rendering and calculations Nesting tables Formatting via tables

4 Table Tables are commonly used on Web pages in two ways:  To organise information  To format the layout of an entire Web page

5 Tables A table is defined as a region that has rows and columns of small rectangles, called cells, that are arranged relative to each other in a certain way that makes up the table layout Web pages that use tables are harder to code

6 Tables Structure & Variables XHTML provide many variables that allow web authors to control table structure Table variables may be grouped into 2 categories:  Non-cell variables  Cell variables

7 Non Cell Variables Non cell variables control the properties and structure of the table, not the actual contents of the table:  caption is the title of the table  summary provides a longer description  border is the table’s outside border  header is the first row of the table  rows are the horizontal layout of the cells  columns are the vertical layout of the cells  width is a representation of the number of columns  height is a representation of the number of rows

8 Non Cell Variables Heading 1Heading 2Heading 3 Cell(1,1)Cell(1,2)Cell(1,3) Cell(2,1)Cell(2,2)Cell(2,3) Cell(3,1)Cell(3,2)Cell(3,3) Cell(4,1)Cell(4,2)Cell(4,3) Cell(5,3)Cell(5,2) Cell(7,1)Cell(7,2)Cell(7,3) Cell(6,3)Cell(6,2)Cell(6,1) Cell(5,1) Width Height Border Rows Columns

9 Cell Variables Cells are the basic units that make up the table Cell variables control the properties and structure of individual cells:  Row span  Column span  Padding  Spacing  Alignment

10 10 Cell Variable: colspan Birthday List James 11/08 Karen 4/17

11 11 Cell Variable: rowspan James 11/08

12 Cell Variables Cell spacing describes the amount of the horizontal and vertical spacing between cells Specifying cell padding is equivalent to specifying top, bottom, left and right margins for the cell Cell content can be aligned within each cell

13 13 Using Tables tag Contains the table Common attributes: border, width, align tag Contains a table row tag Contains a table cell tag Assigns a title to a table

14 14 Using Tables Name Birthday James 11/08 Karen 4/17 Sparky 11/28 4 rows

15 15 Name Birthday James 11/08 Karen 4/17 Sparky 11/28 Using the Element Using Tables

16 This is a Sample Table 1st Heading goes here Cell 1 Cell 2 2nd Heading goes here Cell 3 Cell 4 2nd Heading goes here Cell 5 Cell 6 This is a Sample Table 1st Heading goes here Cell 1 Cell 2 2nd Heading goes here Cell 3 Cell 4 2nd Heading goes here Cell 5 Cell 6

17 Using Tables Cell 1 Cell 3 Cell 5 Cell 2 Cell 4 Cell 5 1 st heading goes here 2 nd heading goes here 3 rd heading goes here This is a Sample Table

18 Table Rendering & Calculations Every table, cell and its content must be displayed properly in the browser The following rules are used by browsers to render and calculate the size of tables  Calculating table width and height ( + width, height)  Calculating the number of columns in a table  Calculating the size of a table cell  Calculating cell spacing and padding  Inheritance of alignment specification

19 Nesting Tables Table nesting is used to control formatting Code is quite complex A table is nested by having a table inside another table Tables can be nested by using a tag after Nesting tables may produce awkward results  Table cell sizes may vary greatly  Location of empty cells may not be acceptable to web authors

20 Using tables Cell 1 Nested Tables T11 T22 T33 Cell 3 Cell 4 Cell 5 Cell 6 Cell 7 Cell 8 Cell 9 Cell 10 Cell 11 Cell 12

21 Formatting a Web Page via Tables Formatting web pages using tables has the same idea as that of nesting tables A web page layout is divided into regions Then a table or a cell is substituted for each region Even formatting web pages using tables can involve the use of nested tables

22 Formatting a Web Page via Tables

23 23 Another Example … This is the banner area Place Navigation here Page content goes here

24 24 Additional Table Layouts Can you write the code for these 2 tables?

25 Accessibility and Tables Use elements to indicate column or row headings. Table element summary attribute  provide an overview of the table contents Table element title attribute  provide a brief description of the table. Associate tags with corresponding tags  tag id attribute  tag headers attribute

26 <table border="1" width="75%" title="Educational Background" summary="This table lists my educational background including school attended, years, subject, and degree awarded (column headings). "> School Attended Years Subject Degree Awarded Schaumburg High School 2000 - 2005 College Prep H.S. Diploma What will this look like?

27 Conclusion Tables Tables  Tables organise and structure web pages  There are table-level and cell cell-level level variables  The purpose of using a table determines its layout and layout and design  There are 5 important tags to use tables  Table calculations and rendering is important because of the number of different parameters involved  Tables can be nested for better structure  Table are extensively used for formatting web pages

28 Reference Steven M. Schafer (2005), HTML, CSS, JavaScript, Perl, and PHP Programmer's Reference, Hungry Minds Inc,U.S. Dan Cederholm (2005), Bulletproof Web Design: Improving Flexibility and Protecting Against Worst-Case Scenarios with XHTML and CSS, New Riders. Ibrahim Zeid (2004), Mastering the Internet, XHTML, and Javascript


Download ppt "Tables 23 rd February. What XHTML have we done so far? Hyperlinks & anchors - XHTML supports 3 types of lists:  Ordered – +  Unordered – +  Definition."

Similar presentations


Ads by Google