SlideShare a Scribd company logo
1 of 60
HTML5, CSS3,
and JavaScript
6th Edition
Working with Tables and Columns
Tutorial 6
Carey
XPXPXPXPXP
2New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Objectives
• Explore the structure of a web table
• Create table heading and data cells
• Apply CSS styles to a table
• Create cells that span multiple rows and
columns
• Add a caption to a table
XPXPXPXPXP
3New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Objectives (continued)
• Create row and column groups
• Apply styles to row and column groups
• Display page elements in table form
• Create a multi-column layout
XPXPXPXPXPStructure of a Web Table
4New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
5New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Introducing Web Tables
• Web table
– HTML structure that consists of multiple table
rows
– Each table row contains one or more table cells
– Effective tool for organizing and classifying web
page content
– Consists of a table element
XPXPXPXPXP
6New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Marking Tables and Table Rows
• A table element contains a collection of table
rows marked using the tr (table row)
element
• A table contains cells within each row
• Size of a table is defined by
– number of table rows
– number of cells within rows
XPXPXPXPXP
7New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Marking Tables and Table Rows
(continued 1)
• General structure of a web table:
<table>
<tr>
table cells
</tr>
<tr>
table cells
</tr>
…
</table>
XPXPXPXPXP
8New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Marking Tables and Table Rows
(continued 2)
XPXPXPXPXP
9New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Marking Table Headings and Table Data
• Web tables support two types of table cells
– Header cells
o Contains content placed at the top of a column or
beginning of a row
o By default, displays text in bold and centers text
horizontally
o Marked using the th element
XPXPXPXPXP
Marking Table Headings and Table Data
(continued 1)
– Data cells
oContains content within columns or rows
oBy default, displays text as unformatted text and is
aligned to the left within the cell
oMarked using the td element
10New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
Marking Table Headings and Table Data
(continued 2)
11New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
Marking Table Headings and Table Data
(continued 3)
12New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
13New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Adding Table Borders with CSS
• The CSS border property is used to add
borders to any part of a web table
• Borders need not be of the same style
• Two style choices for borders
– Separate borders
– Collapsed borders
XPXPXPXPXPAdding Table Borders with CSS (continued 1)
14New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
15New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Adding Table Borders with CSS (continued 2)
• To choose between separate or collapsed
borders model apply the following property to
the table element:
border-collapse: type;
where type is either separate or collapse
• The separate borders model sets the spacing
between borders using
border-spacing: value
where value is in CSS units of measure
XPXPXPXPXP
16New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Adding Table Borders with CSS (continued 3)
• The collapsed borders model
– Borders from adjacent elements are merged
together to form a single border
– Borders are joined to combine their features
– Combining adjacent borders with different
widths, styles, or colors is complicated
XPXPXPXPXP
17New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Adding Table Borders with CSS (continued 4)
• Five rules to reconcile the differences
between adjacent borders
– If either border has a style of hidden, the
collapsed border is hidden
– Border style of none is overridden by another
border style
– The style of wider border takes priority over the
narrower border if neither border is hidden
XPXPXPXPXP
18New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Adding Table Borders with CSS (continued 5)
– Double borders have higher precedence followed
by solid, dashed, ridge, outset, groove and inset
– If borders differ only in color, precedence is given
to borders
– Precedence to borders in decreasing order
o Borders around individual table cells
o Borders for table rows
o Borders for row groups
oBorders for columns
o Borders for column groups
o Borders around the entire table
XPXPXPXPXPAdding Table Borders with CSS (continued 6)
19New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
20New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Spanning Rows and Columns
• Spanning cells
– Single cell that occupies more than one cell row
and/or column
– Created by adding rowspan and/or colspan
attributes to td or th elements
– Spanning starts in the cell with rowspan or
colspan attributes and covers the cells in the
right and below the initial cell
XPXPXPXPXP
21New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Spanning Rows and Columns (continued 1)
– rowspan=“rows”
where rows is the number of rows that the cell
occupies
– colspan = “cols”
where cols is the number of columns that the
cell occupies
XPXPXPXPXPSpanning Rows and Columns (continued 2)
22New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
23New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Spanning Rows and Columns (continued 3)
XPXPXPXPXP
24New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Creating a Table Caption
• Marked using the caption element
<caption>content</caption>
where content is the content contained
within the caption
• Listed immediately after the <table> tag
• Only one caption is allowed per web table
• Inherits the text styles associated with the
table
XPXPXPXPXP
25New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Creating a Table Caption (continued 1)
• By default, captions are placed above the
tables
• To specify the location, use the caption-side
property
caption-side: position;
where position is either top or bottom
XPXPXPXPXPCreating a Table Caption (continued 2)
26New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
27New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Rows and Column Groups
XPXPXPXPXP
28New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Creating Row Groups
• Row groups contain specific table information
• Allows to create different styles for groups of
rows
• HTML supports three row groups
– Rows that belong to the table head
o Marked using thead element
– Rows that belong to the table footer
oMarked using tfoot element
– Rows that belong to the table body
o Marked using tbody element
XPXPXPXPXP
29New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Creating Row Groups (continued 1)
• The general structure of a web table divided
into row groups
<table>
<thead>table rows</thead>
<tfoot>table rows</tfoot>
<tbody>table rows</tbody>
</table>
• Only one thead and tfoot element is allowed
per table
XPXPXPXPXPCreating Row Groups (continued 2)
30New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
31New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Creating Column Groups
• Columns are determined implicitly based on
the number of cells within the table rows
• Columns are identified by the col element
• To identify individual columns, use the id
and/or class attributes
XPXPXPXPXPCreating Column Groups (continued 1)
• Columns can be referred using the following
colgroup element:
<table>
<colgroup>
columns
</colgroup>
table rows
</table>
where columns are the individual columns
defined within the group
32New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
33New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Creating Column Groups (continued 2)
• Columns and column groups accept only CSS
style properties to modify
– column borders
– background
– width
– visibility
XPXPXPXPXP
34New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Creating Column Groups (continued 3)
XPXPXPXPXP
35New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Exploring CSS Styles and Web Tables
• Levels of precedence in the table styles in
decreasing order
– Table cells
– Rows
– Row groups
– Columns
– Column groups
– Table
XPXPXPXPXP
36New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Working with Width and Height
• By default, browsers attempt to fit more
content in each column before wrapping the
cell text
• Extra space is divided equally among columns
if the width of a table is larger than its
individual columns
• Column widths are set using the width
property
XPXPXPXPXP
37New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Working with Width and Height
(continued 1)
• The height of each row is based on the height
of the tallest cell
• A uniform row height is defined by applying
the height style to table rows within each row
group
• The vertical-align property is used to
move the cell text
XPXPXPXPXP
Working with Width and Height
(continued 2)
38New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
39New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Applying Table Styles to Other Page
Elements
• Apply a table layout to other HTML elements
using the CSS display property
XPXPXPXPXP
40New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Applying Table Styles to Other Page
Elements (continued)
XPXPXPXPXP
41New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Tables and Responsive Design
• Tables do not scale well to mobile devices
• Problems faced by users to view a table in a
mobile device
– Table is too small to read
– Table does not fit the visual viewport
– Table columns are too narrow to read the cell
content
XPXPXPXPXPTables and Responsive Design (continued 1)
42New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
43New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Tables and Responsive Design (continued 2)
• A new layout of table data for mobile screens
is required
• Several table columns are reduced to two:
– One column containing all data labels
– Second column containing data associated with
each label
XPXPXPXPXP
44New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Tables and Responsive Design (continued 3)
• To create a responsive web table, add the text
of data labels as attributes of all td elements
in the table body
• Store data labels using a data attribute
• General format of a data attribute is
data-text=“value”
where text is the name of the data attribute
and value is its value
XPXPXPXPXP
45New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Tables and Responsive Design (continued 4)
• Data attributes use names specific to the
function it is used for
• For example, the following code uses a data
attribute named data-label to store the text
of the labels associated with the data cell:
<td data-label=“Date”>April 2,
2017</td>
XPXPXPXPXP
46New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Tables and Responsive Design (continued 5)
• The result is a list of data cells that are aligned
as block elements
• Within each block element, the data label is
followed by the data cell content
• The goal is to transform table with multiple
columns into two-column layout
XPXPXPXPXP
47New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Tables and Responsive Design (continued 6)
XPXPXPXPXP
48New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Designing a Column Layout
• Column layout enables display of content
side-by-side in a page
• Layouts that use float elements or flexboxes
differ from column layout
– Single element can flow from one column to the
next
– Flow of content adjusts to match the page width
XPXPXPXPXP
49New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Setting the Number of Columns
• Size of a column is set using the column-count
property
column-count: value;
where value is the number of columns in the
layout
• Browser extensions are included to ensure
cross-browser compatibility
XPXPXPXPXP
Setting the Number of Columns
(continued)
50New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
51New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Defining Column Widths and Gaps
• Columns are laid out evenly across the width
of the parent element by default
• To set the column width, use the column-
width property
column-width: size;
where size is the minimum width of the
column
• Column width acts like the basis value for
items in a flexbox
XPXPXPXPXP
52New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Defining Column Widths and Gaps
(continued 1)
• The column-width and column-count
properties are combined to form shorthand
columns property
columns: width count;
• The default gap between columns is 1em
• To set a different gap size, use the column-
gap property
column-gap: size;
where size is the width of the gap
XPXPXPXPXP
53New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Defining Column Widths and Gaps
(continued 2)
• Another way to separate columns is with a
graphic dividing line created using the
column-rule property
column-rule: border;
where border defines the style of dividing line
• The column-rule property can be broken into
individual properties like column-rule-
width, column-rule-style, and column-
rule-color
XPXPXPXPXP
Defining Column Widths and Gaps
(continued 3)
54New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
55New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Managing Column Breaks
• The size of column orphans is controlled using
the orphans property
orphans: value;
where value is the minimum number of lines
stranded before a column break
• The size of column widows is controlled using
the widows property
widows: value;
where value is the minimum number of lines
placed after a column break
XPXPXPXPXP
56New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Managing Column Breaks (continued 1)
• Other properties to define column breaks
break-before: type;
break-after: type;
where type is one of the following:
–auto (browser automatically sets column
break)
–always (to always place a column break)
–avoid (to avoid placing a column break)
XPXPXPXPXPManaging Column Breaks (continued 2)
• To control placement of column breaks within
an element, use the property
break-inside: type;
where type is either auto or avoid
57New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXPManaging Column Breaks (continued 3)
58New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
XPXPXPXPXP
59New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
Spanning Cell Columns
• To span cell columns, use the column-span
property
column-span: span;
where span is either none to prevent spanning
or all to enable the content to span across all
the columns
XPXPXPXPXPSpanning Cell Columns (continued)
60New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition

More Related Content

What's hot

Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSDr. Ahmed Al Zaidy
 
Chapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesChapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesDr. Ahmed Al Zaidy
 
Ita3.2 structural and semantic element theory
Ita3.2 structural and semantic element theoryIta3.2 structural and semantic element theory
Ita3.2 structural and semantic element theoryFrank Robell
 
9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented DatabasesFabio Fumarola
 
Developing Dynamic Reports for TMS Using Crystal Reports
Developing Dynamic Reports for TMS Using Crystal ReportsDeveloping Dynamic Reports for TMS Using Crystal Reports
Developing Dynamic Reports for TMS Using Crystal ReportsChad Petrovay
 
Three steps to untangle data traffic jams
Three steps to untangle data traffic jamsThree steps to untangle data traffic jams
Three steps to untangle data traffic jamsBol.com Techlab
 
Tk2323 lecture 7 sql
Tk2323 lecture 7   sql Tk2323 lecture 7   sql
Tk2323 lecture 7 sql MengChun Lam
 

What's hot (9)

Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSS
 
Chapter 11 Working with Events and Styles
Chapter 11 Working with Events and StylesChapter 11 Working with Events and Styles
Chapter 11 Working with Events and Styles
 
Ita3.2 structural and semantic element theory
Ita3.2 structural and semantic element theoryIta3.2 structural and semantic element theory
Ita3.2 structural and semantic element theory
 
9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented Databases
 
Pandas
PandasPandas
Pandas
 
Developing Dynamic Reports for TMS Using Crystal Reports
Developing Dynamic Reports for TMS Using Crystal ReportsDeveloping Dynamic Reports for TMS Using Crystal Reports
Developing Dynamic Reports for TMS Using Crystal Reports
 
Step By Step Guide to Learn R
Step By Step Guide to Learn RStep By Step Guide to Learn R
Step By Step Guide to Learn R
 
Three steps to untangle data traffic jams
Three steps to untangle data traffic jamsThree steps to untangle data traffic jams
Three steps to untangle data traffic jams
 
Tk2323 lecture 7 sql
Tk2323 lecture 7   sql Tk2323 lecture 7   sql
Tk2323 lecture 7 sql
 

Similar to Chapter 6 Working with Tables and Columns

9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.pptSimonChirambira
 
Ppt ch10
Ppt ch10Ppt ch10
Ppt ch10niruttisai
 
Ppt ch10
Ppt ch10Ppt ch10
Ppt ch101geassking
 
Tables in databases - Relationships and diagrams
Tables in  databases - Relationships and diagramsTables in  databases - Relationships and diagrams
Tables in databases - Relationships and diagramsclement swarnappa
 
tutorial 10 Exploring Arrays, Loops, and conditional statements.ppt
tutorial 10 Exploring Arrays, Loops, and conditional statements.ppttutorial 10 Exploring Arrays, Loops, and conditional statements.ppt
tutorial 10 Exploring Arrays, Loops, and conditional statements.pptAbdisamedAdam
 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style SheetsBravocash
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandraTarun Garg
 
DSpace 4.2 XMLUI Theming
DSpace 4.2 XMLUI ThemingDSpace 4.2 XMLUI Theming
DSpace 4.2 XMLUI ThemingDuraSpace
 
Css Grid Layout - A Short Introduction - Part 1
Css Grid Layout - A Short Introduction - Part 1Css Grid Layout - A Short Introduction - Part 1
Css Grid Layout - A Short Introduction - Part 1Adam Michalowski
 
MTA css layouts
MTA css layoutsMTA css layouts
MTA css layoutsDhairya Joshi
 
HTMLTables.ppt
HTMLTables.pptHTMLTables.ppt
HTMLTables.pptArifKamal36
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfelayelily
 
Formatting Text and Links
Formatting Text and LinksFormatting Text and Links
Formatting Text and LinksBravocash
 
Cmgt 410 week 3 final draft
Cmgt 410 week 3 final draftCmgt 410 week 3 final draft
Cmgt 410 week 3 final drafttrunbenppetab1983
 
9781305503922t4-200824144338 (2).pdf
9781305503922t4-200824144338 (2).pdf9781305503922t4-200824144338 (2).pdf
9781305503922t4-200824144338 (2).pdfHaboonMohmed
 
Excel2010 05-130206153751-phpapp01
Excel2010 05-130206153751-phpapp01Excel2010 05-130206153751-phpapp01
Excel2010 05-130206153751-phpapp01Vishal Kumar
 

Similar to Chapter 6 Working with Tables and Columns (20)

9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt9781111528705_PPT_ch10.ppt
9781111528705_PPT_ch10.ppt
 
Ppt ch10
Ppt ch10Ppt ch10
Ppt ch10
 
Ppt ch10
Ppt ch10Ppt ch10
Ppt ch10
 
Tables in databases - Relationships and diagrams
Tables in  databases - Relationships and diagramsTables in  databases - Relationships and diagrams
Tables in databases - Relationships and diagrams
 
tutorial 10 Exploring Arrays, Loops, and conditional statements.ppt
tutorial 10 Exploring Arrays, Loops, and conditional statements.ppttutorial 10 Exploring Arrays, Loops, and conditional statements.ppt
tutorial 10 Exploring Arrays, Loops, and conditional statements.ppt
 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandra
 
DSpace 4.2 XMLUI Theming
DSpace 4.2 XMLUI ThemingDSpace 4.2 XMLUI Theming
DSpace 4.2 XMLUI Theming
 
Css Grid Layout - A Short Introduction - Part 1
Css Grid Layout - A Short Introduction - Part 1Css Grid Layout - A Short Introduction - Part 1
Css Grid Layout - A Short Introduction - Part 1
 
MTA css layouts
MTA css layoutsMTA css layouts
MTA css layouts
 
HTMLTables.ppt
HTMLTables.pptHTMLTables.ppt
HTMLTables.ppt
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
 
Moving Data to and From R
Moving Data to and From RMoving Data to and From R
Moving Data to and From R
 
Bootstrap grids
Bootstrap gridsBootstrap grids
Bootstrap grids
 
Html tables
Html tablesHtml tables
Html tables
 
CSS
CSSCSS
CSS
 
Formatting Text and Links
Formatting Text and LinksFormatting Text and Links
Formatting Text and Links
 
Cmgt 410 week 3 final draft
Cmgt 410 week 3 final draftCmgt 410 week 3 final draft
Cmgt 410 week 3 final draft
 
9781305503922t4-200824144338 (2).pdf
9781305503922t4-200824144338 (2).pdf9781305503922t4-200824144338 (2).pdf
9781305503922t4-200824144338 (2).pdf
 
Excel2010 05-130206153751-phpapp01
Excel2010 05-130206153751-phpapp01Excel2010 05-130206153751-phpapp01
Excel2010 05-130206153751-phpapp01
 

More from Dr. Ahmed Al Zaidy

Chapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingChapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingDr. Ahmed Al Zaidy
 
Chapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptChapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptDr. Ahmed Al Zaidy
 
Chapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaChapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaDr. Ahmed Al Zaidy
 
testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2Dr. Ahmed Al Zaidy
 
Chapter 15 Risk Mitigation
Chapter 15 Risk MitigationChapter 15 Risk Mitigation
Chapter 15 Risk MitigationDr. Ahmed Al Zaidy
 
Chapter 14 Business Continuity
Chapter 14 Business ContinuityChapter 14 Business Continuity
Chapter 14 Business ContinuityDr. Ahmed Al Zaidy
 
Chapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityChapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityDr. Ahmed Al Zaidy
 
Chapter 12 Access Management
Chapter 12 Access ManagementChapter 12 Access Management
Chapter 12 Access ManagementDr. Ahmed Al Zaidy
 
Chapter 11 Authentication and Account Management
Chapter 11 Authentication and Account ManagementChapter 11 Authentication and Account Management
Chapter 11 Authentication and Account ManagementDr. Ahmed Al Zaidy
 
Chapter 10 Mobile and Embedded Device Security
Chapter 10 Mobile and Embedded Device Security Chapter 10 Mobile and Embedded Device Security
Chapter 10 Mobile and Embedded Device Security Dr. Ahmed Al Zaidy
 
Chapter 9 Client and application Security
Chapter 9 Client and application SecurityChapter 9 Client and application Security
Chapter 9 Client and application SecurityDr. Ahmed Al Zaidy
 
Chapter 8 Wireless Network Security
Chapter 8 Wireless Network SecurityChapter 8 Wireless Network Security
Chapter 8 Wireless Network SecurityDr. Ahmed Al Zaidy
 
Chapter 7 Administering a Secure Network
Chapter 7 Administering a Secure Network Chapter 7 Administering a Secure Network
Chapter 7 Administering a Secure Network Dr. Ahmed Al Zaidy
 
Chapter 6Network Security Devices, Design, and Technology
Chapter 6Network Security Devices, Design, and TechnologyChapter 6Network Security Devices, Design, and Technology
Chapter 6Network Security Devices, Design, and TechnologyDr. Ahmed Al Zaidy
 
Chapter 5 Networking and Server Attacks
Chapter 5 Networking and Server AttacksChapter 5 Networking and Server Attacks
Chapter 5 Networking and Server AttacksDr. Ahmed Al Zaidy
 
Chapter 4 Advanced Cryptography and P K I
Chapter 4 Advanced Cryptography and P K IChapter 4 Advanced Cryptography and P K I
Chapter 4 Advanced Cryptography and P K IDr. Ahmed Al Zaidy
 
Chapter 3 Basic Cryptography
Chapter 3 Basic CryptographyChapter 3 Basic Cryptography
Chapter 3 Basic CryptographyDr. Ahmed Al Zaidy
 
Chapter 2 Malware and Social Engineering Attacks
Chapter 2 Malware and Social Engineering AttacksChapter 2 Malware and Social Engineering Attacks
Chapter 2 Malware and Social Engineering AttacksDr. Ahmed Al Zaidy
 

More from Dr. Ahmed Al Zaidy (20)

Chapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based ProgrammingChapter 14 Exploring Object-based Programming
Chapter 14 Exploring Object-based Programming
 
Chapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScriptChapter 9 Getting Started with JavaScript
Chapter 9 Getting Started with JavaScript
 
Chapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimediaChapter 8 Enhancing a website with multimedia
Chapter 8 Enhancing a website with multimedia
 
Integer overflows
Integer overflowsInteger overflows
Integer overflows
 
testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2testing throughout-the-software-life-cycle-section-2
testing throughout-the-software-life-cycle-section-2
 
Fundamental of testing
Fundamental of testingFundamental of testing
Fundamental of testing
 
Chapter 15 Risk Mitigation
Chapter 15 Risk MitigationChapter 15 Risk Mitigation
Chapter 15 Risk Mitigation
 
Chapter 14 Business Continuity
Chapter 14 Business ContinuityChapter 14 Business Continuity
Chapter 14 Business Continuity
 
Chapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data SecurityChapter 13 Vulnerability Assessment and Data Security
Chapter 13 Vulnerability Assessment and Data Security
 
Chapter 12 Access Management
Chapter 12 Access ManagementChapter 12 Access Management
Chapter 12 Access Management
 
Chapter 11 Authentication and Account Management
Chapter 11 Authentication and Account ManagementChapter 11 Authentication and Account Management
Chapter 11 Authentication and Account Management
 
Chapter 10 Mobile and Embedded Device Security
Chapter 10 Mobile and Embedded Device Security Chapter 10 Mobile and Embedded Device Security
Chapter 10 Mobile and Embedded Device Security
 
Chapter 9 Client and application Security
Chapter 9 Client and application SecurityChapter 9 Client and application Security
Chapter 9 Client and application Security
 
Chapter 8 Wireless Network Security
Chapter 8 Wireless Network SecurityChapter 8 Wireless Network Security
Chapter 8 Wireless Network Security
 
Chapter 7 Administering a Secure Network
Chapter 7 Administering a Secure Network Chapter 7 Administering a Secure Network
Chapter 7 Administering a Secure Network
 
Chapter 6Network Security Devices, Design, and Technology
Chapter 6Network Security Devices, Design, and TechnologyChapter 6Network Security Devices, Design, and Technology
Chapter 6Network Security Devices, Design, and Technology
 
Chapter 5 Networking and Server Attacks
Chapter 5 Networking and Server AttacksChapter 5 Networking and Server Attacks
Chapter 5 Networking and Server Attacks
 
Chapter 4 Advanced Cryptography and P K I
Chapter 4 Advanced Cryptography and P K IChapter 4 Advanced Cryptography and P K I
Chapter 4 Advanced Cryptography and P K I
 
Chapter 3 Basic Cryptography
Chapter 3 Basic CryptographyChapter 3 Basic Cryptography
Chapter 3 Basic Cryptography
 
Chapter 2 Malware and Social Engineering Attacks
Chapter 2 Malware and Social Engineering AttacksChapter 2 Malware and Social Engineering Attacks
Chapter 2 Malware and Social Engineering Attacks
 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 

Recently uploaded (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 

Chapter 6 Working with Tables and Columns

  • 1. HTML5, CSS3, and JavaScript 6th Edition Working with Tables and Columns Tutorial 6 Carey
  • 2. XPXPXPXPXP 2New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Objectives • Explore the structure of a web table • Create table heading and data cells • Apply CSS styles to a table • Create cells that span multiple rows and columns • Add a caption to a table
  • 3. XPXPXPXPXP 3New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Objectives (continued) • Create row and column groups • Apply styles to row and column groups • Display page elements in table form • Create a multi-column layout
  • 4. XPXPXPXPXPStructure of a Web Table 4New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 5. XPXPXPXPXP 5New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Introducing Web Tables • Web table – HTML structure that consists of multiple table rows – Each table row contains one or more table cells – Effective tool for organizing and classifying web page content – Consists of a table element
  • 6. XPXPXPXPXP 6New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Marking Tables and Table Rows • A table element contains a collection of table rows marked using the tr (table row) element • A table contains cells within each row • Size of a table is defined by – number of table rows – number of cells within rows
  • 7. XPXPXPXPXP 7New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Marking Tables and Table Rows (continued 1) • General structure of a web table: <table> <tr> table cells </tr> <tr> table cells </tr> … </table>
  • 8. XPXPXPXPXP 8New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Marking Tables and Table Rows (continued 2)
  • 9. XPXPXPXPXP 9New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Marking Table Headings and Table Data • Web tables support two types of table cells – Header cells o Contains content placed at the top of a column or beginning of a row o By default, displays text in bold and centers text horizontally o Marked using the th element
  • 10. XPXPXPXPXP Marking Table Headings and Table Data (continued 1) – Data cells oContains content within columns or rows oBy default, displays text as unformatted text and is aligned to the left within the cell oMarked using the td element 10New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 11. XPXPXPXPXP Marking Table Headings and Table Data (continued 2) 11New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 12. XPXPXPXPXP Marking Table Headings and Table Data (continued 3) 12New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 13. XPXPXPXPXP 13New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Adding Table Borders with CSS • The CSS border property is used to add borders to any part of a web table • Borders need not be of the same style • Two style choices for borders – Separate borders – Collapsed borders
  • 14. XPXPXPXPXPAdding Table Borders with CSS (continued 1) 14New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 15. XPXPXPXPXP 15New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Adding Table Borders with CSS (continued 2) • To choose between separate or collapsed borders model apply the following property to the table element: border-collapse: type; where type is either separate or collapse • The separate borders model sets the spacing between borders using border-spacing: value where value is in CSS units of measure
  • 16. XPXPXPXPXP 16New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Adding Table Borders with CSS (continued 3) • The collapsed borders model – Borders from adjacent elements are merged together to form a single border – Borders are joined to combine their features – Combining adjacent borders with different widths, styles, or colors is complicated
  • 17. XPXPXPXPXP 17New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Adding Table Borders with CSS (continued 4) • Five rules to reconcile the differences between adjacent borders – If either border has a style of hidden, the collapsed border is hidden – Border style of none is overridden by another border style – The style of wider border takes priority over the narrower border if neither border is hidden
  • 18. XPXPXPXPXP 18New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Adding Table Borders with CSS (continued 5) – Double borders have higher precedence followed by solid, dashed, ridge, outset, groove and inset – If borders differ only in color, precedence is given to borders – Precedence to borders in decreasing order o Borders around individual table cells o Borders for table rows o Borders for row groups oBorders for columns o Borders for column groups o Borders around the entire table
  • 19. XPXPXPXPXPAdding Table Borders with CSS (continued 6) 19New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 20. XPXPXPXPXP 20New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Spanning Rows and Columns • Spanning cells – Single cell that occupies more than one cell row and/or column – Created by adding rowspan and/or colspan attributes to td or th elements – Spanning starts in the cell with rowspan or colspan attributes and covers the cells in the right and below the initial cell
  • 21. XPXPXPXPXP 21New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Spanning Rows and Columns (continued 1) – rowspan=“rows” where rows is the number of rows that the cell occupies – colspan = “cols” where cols is the number of columns that the cell occupies
  • 22. XPXPXPXPXPSpanning Rows and Columns (continued 2) 22New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 23. XPXPXPXPXP 23New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Spanning Rows and Columns (continued 3)
  • 24. XPXPXPXPXP 24New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Creating a Table Caption • Marked using the caption element <caption>content</caption> where content is the content contained within the caption • Listed immediately after the <table> tag • Only one caption is allowed per web table • Inherits the text styles associated with the table
  • 25. XPXPXPXPXP 25New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Creating a Table Caption (continued 1) • By default, captions are placed above the tables • To specify the location, use the caption-side property caption-side: position; where position is either top or bottom
  • 26. XPXPXPXPXPCreating a Table Caption (continued 2) 26New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 27. XPXPXPXPXP 27New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Rows and Column Groups
  • 28. XPXPXPXPXP 28New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Creating Row Groups • Row groups contain specific table information • Allows to create different styles for groups of rows • HTML supports three row groups – Rows that belong to the table head o Marked using thead element – Rows that belong to the table footer oMarked using tfoot element – Rows that belong to the table body o Marked using tbody element
  • 29. XPXPXPXPXP 29New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Creating Row Groups (continued 1) • The general structure of a web table divided into row groups <table> <thead>table rows</thead> <tfoot>table rows</tfoot> <tbody>table rows</tbody> </table> • Only one thead and tfoot element is allowed per table
  • 30. XPXPXPXPXPCreating Row Groups (continued 2) 30New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 31. XPXPXPXPXP 31New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Creating Column Groups • Columns are determined implicitly based on the number of cells within the table rows • Columns are identified by the col element • To identify individual columns, use the id and/or class attributes
  • 32. XPXPXPXPXPCreating Column Groups (continued 1) • Columns can be referred using the following colgroup element: <table> <colgroup> columns </colgroup> table rows </table> where columns are the individual columns defined within the group 32New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 33. XPXPXPXPXP 33New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Creating Column Groups (continued 2) • Columns and column groups accept only CSS style properties to modify – column borders – background – width – visibility
  • 34. XPXPXPXPXP 34New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Creating Column Groups (continued 3)
  • 35. XPXPXPXPXP 35New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Exploring CSS Styles and Web Tables • Levels of precedence in the table styles in decreasing order – Table cells – Rows – Row groups – Columns – Column groups – Table
  • 36. XPXPXPXPXP 36New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Working with Width and Height • By default, browsers attempt to fit more content in each column before wrapping the cell text • Extra space is divided equally among columns if the width of a table is larger than its individual columns • Column widths are set using the width property
  • 37. XPXPXPXPXP 37New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Working with Width and Height (continued 1) • The height of each row is based on the height of the tallest cell • A uniform row height is defined by applying the height style to table rows within each row group • The vertical-align property is used to move the cell text
  • 38. XPXPXPXPXP Working with Width and Height (continued 2) 38New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 39. XPXPXPXPXP 39New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Applying Table Styles to Other Page Elements • Apply a table layout to other HTML elements using the CSS display property
  • 40. XPXPXPXPXP 40New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Applying Table Styles to Other Page Elements (continued)
  • 41. XPXPXPXPXP 41New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Tables and Responsive Design • Tables do not scale well to mobile devices • Problems faced by users to view a table in a mobile device – Table is too small to read – Table does not fit the visual viewport – Table columns are too narrow to read the cell content
  • 42. XPXPXPXPXPTables and Responsive Design (continued 1) 42New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 43. XPXPXPXPXP 43New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Tables and Responsive Design (continued 2) • A new layout of table data for mobile screens is required • Several table columns are reduced to two: – One column containing all data labels – Second column containing data associated with each label
  • 44. XPXPXPXPXP 44New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Tables and Responsive Design (continued 3) • To create a responsive web table, add the text of data labels as attributes of all td elements in the table body • Store data labels using a data attribute • General format of a data attribute is data-text=“value” where text is the name of the data attribute and value is its value
  • 45. XPXPXPXPXP 45New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Tables and Responsive Design (continued 4) • Data attributes use names specific to the function it is used for • For example, the following code uses a data attribute named data-label to store the text of the labels associated with the data cell: <td data-label=“Date”>April 2, 2017</td>
  • 46. XPXPXPXPXP 46New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Tables and Responsive Design (continued 5) • The result is a list of data cells that are aligned as block elements • Within each block element, the data label is followed by the data cell content • The goal is to transform table with multiple columns into two-column layout
  • 47. XPXPXPXPXP 47New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Tables and Responsive Design (continued 6)
  • 48. XPXPXPXPXP 48New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Designing a Column Layout • Column layout enables display of content side-by-side in a page • Layouts that use float elements or flexboxes differ from column layout – Single element can flow from one column to the next – Flow of content adjusts to match the page width
  • 49. XPXPXPXPXP 49New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Setting the Number of Columns • Size of a column is set using the column-count property column-count: value; where value is the number of columns in the layout • Browser extensions are included to ensure cross-browser compatibility
  • 50. XPXPXPXPXP Setting the Number of Columns (continued) 50New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 51. XPXPXPXPXP 51New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Defining Column Widths and Gaps • Columns are laid out evenly across the width of the parent element by default • To set the column width, use the column- width property column-width: size; where size is the minimum width of the column • Column width acts like the basis value for items in a flexbox
  • 52. XPXPXPXPXP 52New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Defining Column Widths and Gaps (continued 1) • The column-width and column-count properties are combined to form shorthand columns property columns: width count; • The default gap between columns is 1em • To set a different gap size, use the column- gap property column-gap: size; where size is the width of the gap
  • 53. XPXPXPXPXP 53New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Defining Column Widths and Gaps (continued 2) • Another way to separate columns is with a graphic dividing line created using the column-rule property column-rule: border; where border defines the style of dividing line • The column-rule property can be broken into individual properties like column-rule- width, column-rule-style, and column- rule-color
  • 54. XPXPXPXPXP Defining Column Widths and Gaps (continued 3) 54New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 55. XPXPXPXPXP 55New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Managing Column Breaks • The size of column orphans is controlled using the orphans property orphans: value; where value is the minimum number of lines stranded before a column break • The size of column widows is controlled using the widows property widows: value; where value is the minimum number of lines placed after a column break
  • 56. XPXPXPXPXP 56New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Managing Column Breaks (continued 1) • Other properties to define column breaks break-before: type; break-after: type; where type is one of the following: –auto (browser automatically sets column break) –always (to always place a column break) –avoid (to avoid placing a column break)
  • 57. XPXPXPXPXPManaging Column Breaks (continued 2) • To control placement of column breaks within an element, use the property break-inside: type; where type is either auto or avoid 57New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 58. XPXPXPXPXPManaging Column Breaks (continued 3) 58New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition
  • 59. XPXPXPXPXP 59New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition Spanning Cell Columns • To span cell columns, use the column-span property column-span: span; where span is either none to prevent spanning or all to enable the content to span across all the columns
  • 60. XPXPXPXPXPSpanning Cell Columns (continued) 60New Perspectives on HTML5, CSS3, and JavaScript, 6th Edition