SlideShare a Scribd company logo
Table Styling
Using CSS to Style Tables: So far, our table styling - such has &quot;width&quot; and &quot;border&quot; - has not used CSS. CSS provides us with many tools to style our tables, again with the advantage of being able to make multiple changes to a page with a single edit in the <style> section of the document.
Common Table Styles: You are already familiar with the first four styles listed here.  We have used them for other elements, such as <p>, <h1>, <li>, and <a>. Text alignment in table, row or cell. text-align Border of table, row, or cell. border Padding of table, row, or cell. padding Style Description width Width of table or row. background-color Background color of table, row or cell. color Color of text in table, row, or cell.
More About Borders: The border-style and border-color properties can be defined for specific sides: Specifying 1 value = style applies to all four sides. Specifying 2 values = first applies to top and bottom, second applies to left and right. Specifying 3 values = first applies to top, second applies to right and left, third applies to bottom.  Specifying 4 values = applies to top, right, bottom, left respectively. Collapses double lines around cells into one line. border-collapse Style Description border-width Width of border around table, row, or cell.  Measured in pixels.  Also available are: thin, medium, and thick.  A value of &quot;0&quot; displays no border. border-color Color of border around table, row, or cell. border-style Type of border to display: solid, dashed, dotted, groove, ridge, inset, outset.
Example Border: <head> <style type=&quot;text/css&quot;> table { width:200px; border-width:3px; border-color:red; border-style:solid dashed dotted; } </style> </head> <body> <table> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> <tr> <td>Cell 3</td> <td>Cell 4</td> </tr> <tr> <td>Cell 5</td> <td>Cell 6</td> </tr> </table> </body> Here we have defined the width of the table, the thickness of the border, the color of the border, and the style of the border. Cell 4 Cell 3 Cell 6 Cell 5 Cell 2 Cell 1
Using the Border Shorthand Property: <head> <style type=&quot;text/css&quot;> table { width:200px; border:3px dashed red; } </style> </head> <body> <table> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> <tr> <td>Cell 3</td> <td>Cell 4</td> </tr> <tr> <td>Cell 5</td> <td>Cell 6</td> </tr> </table> </body> We also have the option to use shorthand when specifying the border properties.  The syntax is  border:border-width border-style border-color; This shorthand can be used only when the border style and color are uniform for top, left, bottom, and right. Cell 4 Cell 3 Cell 6 Cell 5 Cell 2 Cell 1
Using CSS Classes to Style Tables: The power of CSS classes can be used when styling tables. For example, we can used two different classes to alternate background colors for table rows, making our table easier to read (much like the tables used in earlier slides).
Using Classes to Style Tables: <head> <style type=&quot;text/css&quot;> table { width:200px; border:3px solid black; } tr.odd { background-color:yellow; } tr.even { background-color:lightblue; } </style> </head> <body> <table> <tr  class=&quot;odd&quot; > <td>Cell 1</td> <td>Cell 2</td> </tr> <tr  class=&quot;even&quot; > <td>Cell 3</td> <td>Cell 4</td> </tr> <tr  class=&quot;odd&quot; > <td>Cell 5</td> <td>Cell 6</td> </tr> </table> </body> By alternating the classes &quot;odd&quot; and &quot;even&quot;, we have made it easier for our web visitors to read the table rows. Cell 4 Cell 3 Cell 6 Cell 5 Cell 2 Cell 1

More Related Content

PPTX
Html table
JayjZens
 
KEY
Lecture3
Lee Lundrigan
 
PPTX
Html_Day_Three(W3Schools)
Rafi Haidari
 
PPTX
HTML Tables
Nisa Soomro
 
PPTX
Html tables
Jagruti Ghadigaonkar
 
PPTX
Web topic 12 tables in html
CK Yang
 
PPTX
HTML Tables
WaheedaBanoShaikh
 
PPTX
Chapter 8: Tables
Steve Guinan
 
Html table
JayjZens
 
Lecture3
Lee Lundrigan
 
Html_Day_Three(W3Schools)
Rafi Haidari
 
HTML Tables
Nisa Soomro
 
Web topic 12 tables in html
CK Yang
 
HTML Tables
WaheedaBanoShaikh
 
Chapter 8: Tables
Steve Guinan
 

What's hot (18)

PPTX
Tables and Forms in HTML
Marlon Jamera
 
PPT
Html introduction Part-2
AAKASH KUMAR
 
PPTX
CSS - LinkedIn
Gino Louie Peña, ITIL®,MOS®
 
PPT
Web forms and html lecture Number 3
Mudasir Syed
 
PPT
Tables and Forms in HTML
Doncho Minkov
 
PPT
Web forms and html (lect 3)
Salman Memon
 
PPTX
TABLE
AKANKSHAGADEKAR1
 
PPT
HTML 5 Tables and Forms
Doncho Minkov
 
PPT
HTML (Hyper Text Markup Language) by Mukesh
Mukesh Kumar
 
PPTX
HTML Table
Rao Mubashar
 
PPT
HTML (Hyper Text Markup Language)
Jishan Ali
 
PPTX
Html Table
nehashinde41
 
PPT
Week3 css
Rowena LI
 
PPTX
HTML Tables
stephenjamesbarcelo15
 
PPTX
HTML [Basic] --by Abdulla-al Baset
Abdulla-al Baset
 
PPT
Css
Rathan Raj
 
Tables and Forms in HTML
Marlon Jamera
 
Html introduction Part-2
AAKASH KUMAR
 
Web forms and html lecture Number 3
Mudasir Syed
 
Tables and Forms in HTML
Doncho Minkov
 
Web forms and html (lect 3)
Salman Memon
 
HTML 5 Tables and Forms
Doncho Minkov
 
HTML (Hyper Text Markup Language) by Mukesh
Mukesh Kumar
 
HTML Table
Rao Mubashar
 
HTML (Hyper Text Markup Language)
Jishan Ali
 
Html Table
nehashinde41
 
Week3 css
Rowena LI
 
HTML [Basic] --by Abdulla-al Baset
Abdulla-al Baset
 
Ad

Viewers also liked (20)

PPTX
CSS Tableless Vs Table Layouts
krishsadasivam
 
PDF
Industrial employment standing_orders_act_1946
Ravi Jaiswal
 
PPT
Questionaire all-students-2011
Mihajlo Gajic
 
DOC
Fstpt10 agung-rev
a_agung_kartika
 
PPTX
Solar energy
Eva Vovka
 
PPSX
Company profile Batikbumi.com
Wahyu Prabowo
 
PPTX
Shpogy secondary school
Eva Vovka
 
PPTX
Dövrlər
Murad İmanbayli
 
PPTX
Marathon Oil Corp. Industry Profile
LIS7205
 
PPT
6.2 css link styling
Bulldogs83
 
PDF
Questionnaire results students-teachers-zr
Mihajlo Gajic
 
PPTX
Global warming
Eva Vovka
 
PPTX
Global dimension in social sciences subjects in formal
Eva Vovka
 
PPTX
Enviornmental injustice
Madhulika Madhulika
 
PPT
Photo album
Mihajlo Gajic
 
PPTX
Fashion than and_now
Eva Vovka
 
PPTX
Πρέγκλερ Κάρολος - Migato - Social Media World 2013
Karolos Pregkler
 
PPTX
Hydroelectricity
Eva Vovka
 
PPSX
Squirrels' day
Eva Vovka
 
CSS Tableless Vs Table Layouts
krishsadasivam
 
Industrial employment standing_orders_act_1946
Ravi Jaiswal
 
Questionaire all-students-2011
Mihajlo Gajic
 
Fstpt10 agung-rev
a_agung_kartika
 
Solar energy
Eva Vovka
 
Company profile Batikbumi.com
Wahyu Prabowo
 
Shpogy secondary school
Eva Vovka
 
Dövrlər
Murad İmanbayli
 
Marathon Oil Corp. Industry Profile
LIS7205
 
6.2 css link styling
Bulldogs83
 
Questionnaire results students-teachers-zr
Mihajlo Gajic
 
Global warming
Eva Vovka
 
Global dimension in social sciences subjects in formal
Eva Vovka
 
Enviornmental injustice
Madhulika Madhulika
 
Photo album
Mihajlo Gajic
 
Fashion than and_now
Eva Vovka
 
Πρέγκλερ Κάρολος - Migato - Social Media World 2013
Karolos Pregkler
 
Hydroelectricity
Eva Vovka
 
Squirrels' day
Eva Vovka
 
Ad

Similar to 4.3 table styling (20)

PPTX
2. Lecture 2 WT - Lists, Tables, and Forms.pptx
tavgaqasim8
 
ODP
Css.prabu
Prabu Cse
 
PDF
Web Design Course: CSS lecture 3
Gheyath M. Othman
 
PPTX
CSS Topic wise Short notes ppt by Navya.E
NavyaEnugala
 
PPTX
HTML Styles - Cascading Style Sheets Cascading Style Sheets
JuliusECatipon
 
PDF
Chapterrrrrrrrrrr_10_Building Tables.pdf
ankitayadavay123
 
PPTX
HTML Tables in Omeka
American Antiquarian Society
 
ODP
Html tut 04
Maxie Santos
 
DOC
Css 1
H K
 
PPT
CSS
ARJUN
 
PPTX
L4 Fashioning Text Styles and Colors
mykella
 
PPTX
WEP4 and 5.pptx
MLikithMahendra
 
PPT
CSS
Gouthaman V
 
PPTX
chapter-gesgsdkfhhgagfhagsdhfgdhfdhda3-css .pptx
berihun18
 
PPTX
CSS
DivyaKS12
 
PPTX
HTML-CSS-QUARTER4 COMPUTER PROGRAMMING SSC
300179
 
PPS
Cascading Style Sheets
Paul Dionysius
 
2. Lecture 2 WT - Lists, Tables, and Forms.pptx
tavgaqasim8
 
Css.prabu
Prabu Cse
 
Web Design Course: CSS lecture 3
Gheyath M. Othman
 
CSS Topic wise Short notes ppt by Navya.E
NavyaEnugala
 
HTML Styles - Cascading Style Sheets Cascading Style Sheets
JuliusECatipon
 
Chapterrrrrrrrrrr_10_Building Tables.pdf
ankitayadavay123
 
HTML Tables in Omeka
American Antiquarian Society
 
Html tut 04
Maxie Santos
 
Css 1
H K
 
CSS
ARJUN
 
L4 Fashioning Text Styles and Colors
mykella
 
WEP4 and 5.pptx
MLikithMahendra
 
chapter-gesgsdkfhhgagfhagsdhfgdhfdhda3-css .pptx
berihun18
 
HTML-CSS-QUARTER4 COMPUTER PROGRAMMING SSC
300179
 
Cascading Style Sheets
Paul Dionysius
 

More from Bulldogs83 (18)

PPT
7.2 external style sheets
Bulldogs83
 
PPT
7.1 xhtml validation
Bulldogs83
 
PPT
6.1 special characters
Bulldogs83
 
PPT
5.2 nesting and floating elements
Bulldogs83
 
PPT
5.1 css box model
Bulldogs83
 
PPT
4.2 css classes
Bulldogs83
 
PPT
4.1 advanced tables
Bulldogs83
 
PPT
3.2 introduction to css
Bulldogs83
 
PPT
3.1 xhtml tables
Bulldogs83
 
PPT
3.2 introduction to css
Bulldogs83
 
PPT
2.1 adding images
Bulldogs83
 
PPT
1.4 adding comments copy (2)
Bulldogs83
 
PPT
1.4 adding comments copy (2)
Bulldogs83
 
PPT
1.3 creating links
Bulldogs83
 
PPT
1.3 creating links
Bulldogs83
 
PPT
1.2 elements and attributes copy (3)
Bulldogs83
 
PPT
1.2 elements and attributes copy (3)
Bulldogs83
 
PPT
1.1 xhtml basics
Bulldogs83
 
7.2 external style sheets
Bulldogs83
 
7.1 xhtml validation
Bulldogs83
 
6.1 special characters
Bulldogs83
 
5.2 nesting and floating elements
Bulldogs83
 
5.1 css box model
Bulldogs83
 
4.2 css classes
Bulldogs83
 
4.1 advanced tables
Bulldogs83
 
3.2 introduction to css
Bulldogs83
 
3.1 xhtml tables
Bulldogs83
 
3.2 introduction to css
Bulldogs83
 
2.1 adding images
Bulldogs83
 
1.4 adding comments copy (2)
Bulldogs83
 
1.4 adding comments copy (2)
Bulldogs83
 
1.3 creating links
Bulldogs83
 
1.3 creating links
Bulldogs83
 
1.2 elements and attributes copy (3)
Bulldogs83
 
1.2 elements and attributes copy (3)
Bulldogs83
 
1.1 xhtml basics
Bulldogs83
 

Recently uploaded (20)

PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
CDH. pptx
AneetaSharma15
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 

4.3 table styling

  • 2. Using CSS to Style Tables: So far, our table styling - such has &quot;width&quot; and &quot;border&quot; - has not used CSS. CSS provides us with many tools to style our tables, again with the advantage of being able to make multiple changes to a page with a single edit in the <style> section of the document.
  • 3. Common Table Styles: You are already familiar with the first four styles listed here. We have used them for other elements, such as <p>, <h1>, <li>, and <a>. Text alignment in table, row or cell. text-align Border of table, row, or cell. border Padding of table, row, or cell. padding Style Description width Width of table or row. background-color Background color of table, row or cell. color Color of text in table, row, or cell.
  • 4. More About Borders: The border-style and border-color properties can be defined for specific sides: Specifying 1 value = style applies to all four sides. Specifying 2 values = first applies to top and bottom, second applies to left and right. Specifying 3 values = first applies to top, second applies to right and left, third applies to bottom. Specifying 4 values = applies to top, right, bottom, left respectively. Collapses double lines around cells into one line. border-collapse Style Description border-width Width of border around table, row, or cell. Measured in pixels. Also available are: thin, medium, and thick. A value of &quot;0&quot; displays no border. border-color Color of border around table, row, or cell. border-style Type of border to display: solid, dashed, dotted, groove, ridge, inset, outset.
  • 5. Example Border: <head> <style type=&quot;text/css&quot;> table { width:200px; border-width:3px; border-color:red; border-style:solid dashed dotted; } </style> </head> <body> <table> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> <tr> <td>Cell 3</td> <td>Cell 4</td> </tr> <tr> <td>Cell 5</td> <td>Cell 6</td> </tr> </table> </body> Here we have defined the width of the table, the thickness of the border, the color of the border, and the style of the border. Cell 4 Cell 3 Cell 6 Cell 5 Cell 2 Cell 1
  • 6. Using the Border Shorthand Property: <head> <style type=&quot;text/css&quot;> table { width:200px; border:3px dashed red; } </style> </head> <body> <table> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> <tr> <td>Cell 3</td> <td>Cell 4</td> </tr> <tr> <td>Cell 5</td> <td>Cell 6</td> </tr> </table> </body> We also have the option to use shorthand when specifying the border properties. The syntax is border:border-width border-style border-color; This shorthand can be used only when the border style and color are uniform for top, left, bottom, and right. Cell 4 Cell 3 Cell 6 Cell 5 Cell 2 Cell 1
  • 7. Using CSS Classes to Style Tables: The power of CSS classes can be used when styling tables. For example, we can used two different classes to alternate background colors for table rows, making our table easier to read (much like the tables used in earlier slides).
  • 8. Using Classes to Style Tables: <head> <style type=&quot;text/css&quot;> table { width:200px; border:3px solid black; } tr.odd { background-color:yellow; } tr.even { background-color:lightblue; } </style> </head> <body> <table> <tr class=&quot;odd&quot; > <td>Cell 1</td> <td>Cell 2</td> </tr> <tr class=&quot;even&quot; > <td>Cell 3</td> <td>Cell 4</td> </tr> <tr class=&quot;odd&quot; > <td>Cell 5</td> <td>Cell 6</td> </tr> </table> </body> By alternating the classes &quot;odd&quot; and &quot;even&quot;, we have made it easier for our web visitors to read the table rows. Cell 4 Cell 3 Cell 6 Cell 5 Cell 2 Cell 1