SlideShare a Scribd company logo
1 of 2
WEBPROG1-Web Programming 1(HTML)                                          Prelim Period
                                                                             Handout 5


HTML Tables

    Tables may seem difficult at first, but after working through this lesson you'll see
how they aren't too bad. The <table> tag is used to being the table. Within a table
element are the <tr> (table rows) and <td> (table columns) tags. Tables are a
handy way to create a site's layout, but it does take some getting used to. Here's
how to make a table.

Code:
<table border="1">
<tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>
<tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>
</table>

Display:
Row 1 Cell 1 Row 1 Cell 2
Row 2 Cell 1 Row 2 Cell 2

    Content is placed within tables cells. A table cell is defined by <td> and </td>.
The border attribute defines how wide the table's border will be.


Spanning Multiple Rows and Cells

    Use rowspan to span multiple rows and colspan to span multiple columns.

    Note: if you would like to place headers at the top of your columns, use the
<th> tag as shown below. By default these headers are bold to set them apart from
the rest of your table's content.

Code:
<table border="1">
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<tr><td rowspan="2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td><td>Row 1 Cell 3</td></tr>
<tr><td>Row 2 Cell 2</td><td>Row 2 Cell 3</td></tr>
<tr><td colspan="3">Row 3 Cell 1</td></tr>
</table>

Display:
 Column 1       Column 2     Column 3
               Row 1 Cell 2 Row 1 Cell 3
Row 1 Cell 1
               Row 2 Cell 2 Row 2 Cell 3
Row 3 Cell 1




Prepared By: RICHARD F. ORPIANO                                             Page 1 of 2
WEBPROG1-Web Programming 1(HTML)                                      Prelim Period
                                                                          Handout 5


 Cell Padding and Spacing

     With the cellpadding and cellspacing attributes you will be able to adjust the
 white space on your tables. Spacing defines the width of the border, while padding
 represents the distance between cell borders and the content within. Color has been
 added to the table to emphasize these attributes.

 Code:
 <table border="1" cellspacing="10"
 bgcolor="rgb(0,255,0)">
 <th>Column 1</th>
 <th>Column 2</th>
 <tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>
 <tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>
 </table>

 Display:
  Column 1        Column 2
Row 1 Cell 1    Row 1 Cell 2
Row 2 Cell 1    Row 2 Cell 2

     And now we will change the cellpadding of the table and remove the cellspacing
 from the previous example.

 Code:
 <table border="1" cellpadding="10"
 bgcolor="rgb(0,255,0)">
 <th>Column 1</th>
 <th>Column 2</th>
 <tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>
 <tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>
 </table>

 Display:
  Column 1         Column 2

 Row 1 Cell 1     Row 1 Cell 2

 Row 2 Cell 1     Row 2 Cell 2


     The value you specify for padding and spacing is interpreted by the browser as a
 pixel value you. So a value of 10 is simply 10 pixels wide. Most attributes that use
 numeric values for their measurements use pixels.




 Prepared By: RICHARD F. ORPIANO                                         Page 2 of 2

More Related Content

What's hot

Html introduction Part-2
Html introduction Part-2Html introduction Part-2
Html introduction Part-2AAKASH KUMAR
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTMLDoncho Minkov
 
Intro To TSQL - Unit 3
Intro To TSQL - Unit 3Intro To TSQL - Unit 3
Intro To TSQL - Unit 3iccma
 
Web forms and html lecture Number 3
Web forms and html lecture Number 3Web forms and html lecture Number 3
Web forms and html lecture Number 3Mudasir Syed
 
Web topic 12 tables in html
Web topic 12  tables in htmlWeb topic 12  tables in html
Web topic 12 tables in htmlCK Yang
 
12th Computer practical pattern (sci & com both)
12th Computer practical pattern (sci & com both)12th Computer practical pattern (sci & com both)
12th Computer practical pattern (sci & com both)Sabiha Saiyed
 
Frames tables forms
Frames tables formsFrames tables forms
Frames tables formsnobel mujuji
 
Bt0075, rdbms and my sql
Bt0075, rdbms and my sqlBt0075, rdbms and my sql
Bt0075, rdbms and my sqlsmumbahelp
 
5 saving data to the database
5 saving data to the database5 saving data to the database
5 saving data to the databasepvenky1578
 

What's hot (20)

html-table
html-tablehtml-table
html-table
 
HTML Tables
HTML TablesHTML Tables
HTML Tables
 
HTML Tables
HTML TablesHTML Tables
HTML Tables
 
Html introduction Part-2
Html introduction Part-2Html introduction Part-2
Html introduction Part-2
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
 
HTML Table Tags
HTML Table TagsHTML Table Tags
HTML Table Tags
 
Html tables examples
Html tables   examplesHtml tables   examples
Html tables examples
 
HTML Dasar : #9 Tabel
HTML Dasar : #9 TabelHTML Dasar : #9 Tabel
HTML Dasar : #9 Tabel
 
Html&css lesson 2
Html&css lesson 2Html&css lesson 2
Html&css lesson 2
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
Table and Form HTML&CSS
Table and Form HTML&CSSTable and Form HTML&CSS
Table and Form HTML&CSS
 
Intro To TSQL - Unit 3
Intro To TSQL - Unit 3Intro To TSQL - Unit 3
Intro To TSQL - Unit 3
 
Web forms and html lecture Number 3
Web forms and html lecture Number 3Web forms and html lecture Number 3
Web forms and html lecture Number 3
 
Web topic 12 tables in html
Web topic 12  tables in htmlWeb topic 12  tables in html
Web topic 12 tables in html
 
12th Computer practical pattern (sci & com both)
12th Computer practical pattern (sci & com both)12th Computer practical pattern (sci & com both)
12th Computer practical pattern (sci & com both)
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Frames tables forms
Frames tables formsFrames tables forms
Frames tables forms
 
Bt0075, rdbms and my sql
Bt0075, rdbms and my sqlBt0075, rdbms and my sql
Bt0075, rdbms and my sql
 
Bootstarp 3
Bootstarp 3Bootstarp 3
Bootstarp 3
 
5 saving data to the database
5 saving data to the database5 saving data to the database
5 saving data to the database
 

Viewers also liked (6)

Handout6 html frames
Handout6 html framesHandout6 html frames
Handout6 html frames
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Handout7 html forms
Handout7 html formsHandout7 html forms
Handout7 html forms
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Writing chapter 3
Writing chapter 3Writing chapter 3
Writing chapter 3
 

Similar to Handout5 tables

Similar to Handout5 tables (20)

Table structure introduction
Table structure introductionTable structure introduction
Table structure introduction
 
v4-html-table-210321161424.pptx
v4-html-table-210321161424.pptxv4-html-table-210321161424.pptx
v4-html-table-210321161424.pptx
 
01 HTML-Tables-1.pptx
01 HTML-Tables-1.pptx01 HTML-Tables-1.pptx
01 HTML-Tables-1.pptx
 
Web I - 03 - Tables
Web I - 03 - TablesWeb I - 03 - Tables
Web I - 03 - Tables
 
HTML Tables.ppt
HTML Tables.pptHTML Tables.ppt
HTML Tables.ppt
 
Lecture 2.ppt
Lecture 2.pptLecture 2.ppt
Lecture 2.ppt
 
Response Tables.ppt
Response Tables.pptResponse Tables.ppt
Response Tables.ppt
 
Html tables
Html tablesHtml tables
Html tables
 
Lecture-4.pptx
Lecture-4.pptxLecture-4.pptx
Lecture-4.pptx
 
2. HTML Tables.ppt
2. HTML Tables.ppt2. HTML Tables.ppt
2. HTML Tables.ppt
 
HTML Lecture Part 2 of 2
HTML Lecture Part 2 of 2HTML Lecture Part 2 of 2
HTML Lecture Part 2 of 2
 
Tables
TablesTables
Tables
 
HTML TABLES
HTML TABLESHTML TABLES
HTML TABLES
 
Css tables
Css tablesCss tables
Css tables
 
Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptx
 
Chapter 8: Tables
Chapter 8: TablesChapter 8: Tables
Chapter 8: Tables
 
Lecture 5 html table
Lecture 5 html tableLecture 5 html table
Lecture 5 html table
 
WEP4 and 5.pptx
WEP4 and 5.pptxWEP4 and 5.pptx
WEP4 and 5.pptx
 
Tables and their padding in HTML etc.pptx
Tables and their padding in HTML etc.pptxTables and their padding in HTML etc.pptx
Tables and their padding in HTML etc.pptx
 
HTML
HTMLHTML
HTML
 

More from Nadine Guevarra (17)

Handout4 lists
Handout4 listsHandout4 lists
Handout4 lists
 
Handout3 links
Handout3 linksHandout3 links
Handout3 links
 
Handout2 formatting tags
Handout2 formatting tagsHandout2 formatting tags
Handout2 formatting tags
 
Handout1 intro to html
Handout1 intro to htmlHandout1 intro to html
Handout1 intro to html
 
Questionnaire
QuestionnaireQuestionnaire
Questionnaire
 
War and man’s past
War and man’s pastWar and man’s past
War and man’s past
 
Olympics
OlympicsOlympics
Olympics
 
Mother and child
Mother and childMother and child
Mother and child
 
Lec no. 3 comp hardware components
Lec no. 3 comp hardware componentsLec no. 3 comp hardware components
Lec no. 3 comp hardware components
 
Intro to spreadsheet
Intro to spreadsheetIntro to spreadsheet
Intro to spreadsheet
 
Excel.01
Excel.01Excel.01
Excel.01
 
Robert frost 001
Robert frost 001Robert frost 001
Robert frost 001
 
On giving 001
On giving 001On giving 001
On giving 001
 
Poetry 001
Poetry 001Poetry 001
Poetry 001
 
Robert frost 001
Robert frost 001Robert frost 001
Robert frost 001
 
The river merchant's wife 001
The river merchant's wife 001The river merchant's wife 001
The river merchant's wife 001
 
Wl lecture 2 essay 001
Wl lecture 2 essay 001Wl lecture 2 essay 001
Wl lecture 2 essay 001
 

Recently uploaded

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

Handout5 tables

  • 1. WEBPROG1-Web Programming 1(HTML) Prelim Period Handout 5 HTML Tables Tables may seem difficult at first, but after working through this lesson you'll see how they aren't too bad. The <table> tag is used to being the table. Within a table element are the <tr> (table rows) and <td> (table columns) tags. Tables are a handy way to create a site's layout, but it does take some getting used to. Here's how to make a table. Code: <table border="1"> <tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr> <tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr> </table> Display: Row 1 Cell 1 Row 1 Cell 2 Row 2 Cell 1 Row 2 Cell 2 Content is placed within tables cells. A table cell is defined by <td> and </td>. The border attribute defines how wide the table's border will be. Spanning Multiple Rows and Cells Use rowspan to span multiple rows and colspan to span multiple columns. Note: if you would like to place headers at the top of your columns, use the <th> tag as shown below. By default these headers are bold to set them apart from the rest of your table's content. Code: <table border="1"> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> <tr><td rowspan="2">Row 1 Cell 1</td> <td>Row 1 Cell 2</td><td>Row 1 Cell 3</td></tr> <tr><td>Row 2 Cell 2</td><td>Row 2 Cell 3</td></tr> <tr><td colspan="3">Row 3 Cell 1</td></tr> </table> Display: Column 1 Column 2 Column 3 Row 1 Cell 2 Row 1 Cell 3 Row 1 Cell 1 Row 2 Cell 2 Row 2 Cell 3 Row 3 Cell 1 Prepared By: RICHARD F. ORPIANO Page 1 of 2
  • 2. WEBPROG1-Web Programming 1(HTML) Prelim Period Handout 5 Cell Padding and Spacing With the cellpadding and cellspacing attributes you will be able to adjust the white space on your tables. Spacing defines the width of the border, while padding represents the distance between cell borders and the content within. Color has been added to the table to emphasize these attributes. Code: <table border="1" cellspacing="10" bgcolor="rgb(0,255,0)"> <th>Column 1</th> <th>Column 2</th> <tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr> <tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr> </table> Display: Column 1 Column 2 Row 1 Cell 1 Row 1 Cell 2 Row 2 Cell 1 Row 2 Cell 2 And now we will change the cellpadding of the table and remove the cellspacing from the previous example. Code: <table border="1" cellpadding="10" bgcolor="rgb(0,255,0)"> <th>Column 1</th> <th>Column 2</th> <tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr> <tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr> </table> Display: Column 1 Column 2 Row 1 Cell 1 Row 1 Cell 2 Row 2 Cell 1 Row 2 Cell 2 The value you specify for padding and spacing is interpreted by the browser as a pixel value you. So a value of 10 is simply 10 pixels wide. Most attributes that use numeric values for their measurements use pixels. Prepared By: RICHARD F. ORPIANO Page 2 of 2