SlideShare a Scribd company logo
1 of 35
CSM 399
Lecture 3
Jan 2016
Web based concepts and development
Emmanuel Ofori Oppong
eoforioppong@yahoo.com // 0244213859
HTML Tables
HTML Tables
• Tables represent tabular data
• A table consists of one or several rows
• Each row has one or more columns
• Tables comprised of several core tags: <table></table>: begin / end the
table
<tr></tr>: create a table row
<td></td>: create tabular data (cell)
• Tables should not be used for layout. Use CSS floats and positioning styles
instead
2
HTML Tables (2)
• Start and end of a table
• Start and end of a row
• Start and end of a cell in a row
3
<table> ... </table>
<tr> ... </tr>
<td> ... </td>
Simple HTML Tables – Example
4
<table cellspacing="0" cellpadding="5">
<tr>
<td><img src="ppt.gif"></td>
<td><a href="lecture1.ppt">Lecture 1</a></td>
</tr>
<tr>
<td><img src="ppt.gif"></td>
<td><a href="lecture2.ppt">Lecture 2</a></td>
</tr>
<tr>
<td><img src="zip.gif"></td>
<td><a href="lecture2-demos.zip">
Lecture 2 - Demos</a></td>
</tr>
</table>
<table cellspacing="0" cellpadding="5">
<tr>
<td><img src="ppt.gif"></td>
<td><a href="lecture1.ppt">Lecture 1</a></td>
</tr>
<tr>
<td><img src="ppt.gif"></td>
<td><a href="lecture2.ppt">Lecture 2</a></td>
</tr>
<tr>
<td><img src="zip.gif"></td>
<td><a href="lecture2-demos.zip">
Lecture 2 - Demos</a></td>
</tr>
</table>
Simple HTML Tables – Example (2)
5
Complete HTML Tables
• Table rows split into three semantic sections: header, body and
footer
• <thead> denotes table header and contains <th> elements, instead of
<td> elements
• <tbody> denotes collection of table rows that contain the very data
• <tfoot> denotes table footer but comes BEFORE the <tbody> tag
• <colgroup> and <col> define columns (most often used to set column
widths)
6
Complete HTML Table: Example
7
<table>
<colgroup>
<col style="width:100px" /><col />
</colgroup>
<thead>
<tr><th>Column 1</th><th>Column 2</th></tr>
</thead>
<tfoot>
<tr><td>Footer 1</td><td>Footer 2</td></tr>
</tfoot>
<tbody>
<tr><td>Cell 1.1</td><td>Cell 1.2</td></tr>
<tr><td>Cell 2.1</td><td>Cell 2.2</td></tr>
</tbody>
</table>
header
footer
Last comes the body (data)
th
columns
<table>
<colgroup>
<col style="width:200px" /><col />
</colgroup>
<thead>
<tr><th>Column 1</th><th>Column 2</th></tr>
</thead>
<tfoot>
<tr><td>Footer 1</td><td>Footer 2</td></tr>
</tfoot>
<tbody>
<tr><td>Cell 1.1</td><td>Cell 1.2</td></tr>
<tr><td>Cell 2.1</td><td>Cell 2.2</td></tr>
</tbody>
</table>
Complete HTML Table:
Example (2)
8
table-full.html
Although the footer is
before the data in the
code, it is displayed last
By default, header text is
bold and centered.
Nested Tables
• Table data “cells” (<td>) can contain nested
tables (tables within tables):
9
<table>
<tr>
<td>Contact:</td>
<td>
<table>
<tr>
<td>First Name</td>
<td>Last Name</td>
</tr>
</table>
</td>
</tr>
</table>
nested-tables.html
 cellpadding
 Defines the empty
space around the cell
content
 cellspacing
 Defines the
empty space
between cells
Cell Spacing and Padding
• Tables have two important attributes:
10
cell cell
cell cell
cell
cell
cell
cell
Cell Spacing and Padding –
Example
11
<html>
<head><title>Table Cells</title></head>
<body>
<table cellspacing="15" cellpadding="0">
<tr><td>First</td>
<td>Second</td></tr>
</table>
<br/>
<table cellspacing="0" cellpadding="10">
<tr><td>First</td><td>Second</td></tr>
</table>
</body>
</html>
table-cells.html
Cell Spacing and Padding –
Example (2)
12
<html>
<head><title>Table Cells</title></head>
<body>
<table cellspacing="15" cellpadding="0">
<tr><td>First</td>
<td>Second</td></tr>
</table>
<br/>
<table cellspacing="0" cellpadding="10">
<tr><td>First</td><td>Second</td></tr>
</table>
</body>
</html>
table-cells.html
 rowspan
 Defines how
many rows the
cell occupies
 colspan
 Defines how
many columns
the cell occupies
Column and Row Span
• Table cells have two important attributes:
13
cell[1,1] cell[1,2]
cell[2,1]
colspan="1"
colspan="1"
colspan="2"
cell[1,1]
cell[1,2]
cell[2,1]
rowspan="2" rowspan="1"
rowspan="1"
Column and Row Span – Example
14
<table cellspacing="0">
<tr class="1"><td>Cell[1,1]</td>
<td colspan="2">Cell[2,1]</td></tr>
<tr class=“2"><td>Cell[1,2]</td>
<td rowspan="2">Cell[2,2]</td>
<td>Cell[3,2]</td></tr>
<tr class=“3"><td>Cell[1,3]</td>
<td>Cell[2,3]</td></tr>
</table>
table-colspan-rowspan.html
<table cellspacing="0">
<tr class="1"><td>Cell[1,1]</td>
<td colspan="2">Cell[2,1]</td></tr>
<tr class=“2"><td>Cell[1,2]</td>
<td rowspan="2">Cell[2,2]</td>
<td>Cell[3,2]</td></tr>
<tr class=“3"><td>Cell[1,3]</td>
<td>Cell[2,3]</td></tr>
</table>
Column and Row Span –
Example (2)
15
table-colspan-rowspan.html
Cell[2,3]
Cell[1,3]
Cell[3,2]
Cell[2,2]
Cell[1,2]
Cell[2,1]
Cell[1,1]
HTML Forms
Entering User Data from a Web Page
HTML Forms
• Forms are the primary method for gathering data from site
visitors
• Create a form block with
• Example:
17
<form></form>
<form name="myForm" method="post"
action="path/to/some-script.php">
...
</form>
The "action" attribute tells where
the form data should be sent
The “method" attribute tells how
the form data should be sent – via
GET or POST request
Form Fields
• Single-line text input fields:
• Multi-line textarea fields:
• Hidden fields contain data not shown to the user:
• Often used by JavaScript code
18
<input type="text" name="FirstName" value="This
is a text field" />
<textarea name="Comments">This is a multi-line
text field</textarea>
<input type="hidden" name="Account" value="This
is a hidden text field" />
Fieldsets
• Fieldsets are used to enclose a group of related form fields:
19
<form method="post" action="form.aspx">
<fieldset>
<legend>Client Details</legend>
<input type="text" id="Name" />
<input type="text" id="Phone" />
</fieldset>
<fieldset>
<legend>Order Details</legend>
<input type="text" id="Quantity" />
<textarea cols="40" rows="10"
id="Remarks"></textarea>
</fieldset>
</form>
Form Input Controls
• Checkboxes:
• Radio buttons:
• Radio buttons can be grouped, allowing only one to be
selected from a group:
20
<input type="checkbox" name="fruit"
value="apple" />
<input type="radio" name="title" value="Mr." />
<input type="radio" name="city" value="Lom" />
<input type="radio" name="city" value="Ruse" />
Other Form Controls
• Dropdown menus:
• Submit button:
21
<select name="gender">
<option value="Value 1"
selected="selected">Male</option>
<option value="Value 2">Female</option>
<option value="Value 3">Other</option>
</select>
<input type="submit" name="submitBtn"
value="Apply Now" />
Other Form Controls (2)
• Reset button – brings the form to its initial state
• Image button – acts like submit but image is displayed and
click coordinates are sent
• Ordinary button – used for Javascript, no default action
22
<input type="reset" name="resetBtn"
value="Reset the form" />
<input type="image" src="submit.gif"
name="submitBtn" alt="Submit" />
<input type="button" value="click me" />
Other Form Controls (3)
• Password input – a text field which masks the entered text
with * signs
• Multiple select field – displays the list of items in multiple
lines, instead of one
23
<input type="password" name="pass" />
<select name="products" multiple="multiple">
<option value="Value 1"
selected="selected">keyboard</option>
<option value="Value 2">mouse</option>
<option value="Value 3">speakers</option>
</select>
Other Form Controls (4)
• File input – a field used for uploading files
• When used, it requires the form element to have a specific
attribute:
24
<input type="file" name="photo" />
<form enctype="multipart/form-data">
...
<input type="file" name="photo" />
...
</form>
Labels
• Form labels are used to associate an explanatory text to a
form field using the field's ID.
• Clicking on a label focuses its associated field (checkboxes
are toggled, radio buttons are checked)
• Labels are both a usability and accessibility feature and are
required in order to pass accessibility validation.
25
<label for="fn">First Name</label>
<input type="text" id="fn" />
HTML Forms – Example
26
<form method="post" action="apply-now.php">
<input name="subject" type="hidden" value="Class" />
<fieldset><legend>Academic information</legend>
<label for="degree">Degree</label>
<select name="degree" id="degree">
<option value="BA">Bachelor of Art</option>
<option value="BS">Bachelor of Science</option>
<option value="MBA" selected="selected">Master of
Business Administration</option>
</select>
<br />
<label for="studentid">Student ID</label>
<input type="password" name="studentid" />
</fieldset>
<fieldset><legend>Personal Details</legend>
<label for="fname">First Name</label>
<input type="text" name="fname" id="fname" />
<br />
<label for="lname">Last Name</label>
<input type="text" name="lname" id="lname" />
form.html
HTML Forms – Example (2)
27
<br />
Gender:
<input name="gender" type="radio" id="gm" value="m" />
<label for="gm">Male</label>
<input name="gender" type="radio" id="gf" value="f" />
<label for="gf">Female</label>
<br />
<label for="email">Email</label>
<input type="text" name="email" id="email" />
</fieldset>
<p>
<textarea name="terms" cols="30" rows="4"
readonly="readonly">TERMS AND CONDITIONS...</textarea>
</p>
<p>
<input type="submit" name="submit" value="Send Form" />
<input type="reset" value="Clear Form" />
</p>
</form>
form.html (continued)
form.html (continued)
HTML Forms – Example (3)
28
TabIndex
• The tabindex HTML attribute controls the order in which form
fields and hyperlinks are focused when repeatedly pressing the
TAB key
• tabindex="0" (zero) - "natural" order
• If X > Y, then elements with tabindex="X" are iterated before elements
with tabindex="Y"
• Elements with negative tabindex are skipped, however, this is not
defined in the standard
29
<input type="text" tabindex="10" />
HTML Frames
<frameset>, <frame> and <iframe>
HTML Frames
• Frames provide a way to show multiple HTML documents in a
single Web page
• The page can be split into separate views (frames) horizontally
and vertically
• Frames were popular in the early ages of HTML development,
but now their usage is rejected
• Frames are not supported by all user agents (browsers, search
engines, etc.)
• A <noframes> element is used to provide content for non-compatible
agents.
31
HTML Frames – Demo
32
<html>
<head><title>Frames Example</title></head>
<frameset cols="180px,*,150px">
<frame src="left.html" />
<frame src="middle.html" />
<frame src="right.html" />
</frameset>
</html>
frames.html
 Note the target attribute applied to the <a>
elements in the left frame.
Inline Frames: <iframe>
• Inline frames provide a way to show one website inside another
website:
33
<iframe name="iframeGoogle" width="600" height="400"
src="http://www.google.com" frameborder="yes"
scrolling="yes"></iframe>
iframe-demo.html
Thank You
For any concerns, please contact
elearning@knust.edu.gh
elearningknust@gmail.com
0322 191132
Jan 2014

More Related Content

Similar to Tables and their padding in HTML etc.pptx

Similar to Tables and their padding in HTML etc.pptx (20)

HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
 
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
 
Tables and Forms in HTML
Tables and Forms in HTMLTables and Forms in HTML
Tables and Forms in HTML
 
PPT-203105353-1.pdf
PPT-203105353-1.pdfPPT-203105353-1.pdf
PPT-203105353-1.pdf
 
Web technology
Web technologyWeb technology
Web technology
 
HTML Basic
HTML BasicHTML Basic
HTML Basic
 
hyper text markup language ppt presentation
hyper text markup language ppt presentationhyper text markup language ppt presentation
hyper text markup language ppt presentation
 
HTML_TABLES,FORMS,FRAME markup lang.pptx
HTML_TABLES,FORMS,FRAME markup lang.pptxHTML_TABLES,FORMS,FRAME markup lang.pptx
HTML_TABLES,FORMS,FRAME markup lang.pptx
 
Table and Form HTML&CSS
Table and Form HTML&CSSTable and Form HTML&CSS
Table and Form HTML&CSS
 
Lecture 5 html table
Lecture 5 html tableLecture 5 html table
Lecture 5 html table
 
Html tables examples
Html tables   examplesHtml tables   examples
Html tables examples
 
Frames tables forms
Frames tables formsFrames tables forms
Frames tables forms
 
Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptx
 
Practicals it
Practicals itPracticals it
Practicals it
 
Html and css
Html and cssHtml and css
Html and css
 
table html web programing
table  html  web programingtable  html  web programing
table html web programing
 
HTML Tables and Forms
HTML Tables and Forms HTML Tables and Forms
HTML Tables and Forms
 
Caracteristicas Basicas De Htlm
Caracteristicas Basicas De HtlmCaracteristicas Basicas De Htlm
Caracteristicas Basicas De Htlm
 
Intodcution to Html
Intodcution to HtmlIntodcution to Html
Intodcution to Html
 
INTRODUCTION TO HTML & CSS .pptx
INTRODUCTION TO HTML & CSS .pptxINTRODUCTION TO HTML & CSS .pptx
INTRODUCTION TO HTML & CSS .pptx
 

Recently uploaded

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 

Recently uploaded (20)

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 

Tables and their padding in HTML etc.pptx

  • 1. CSM 399 Lecture 3 Jan 2016 Web based concepts and development Emmanuel Ofori Oppong eoforioppong@yahoo.com // 0244213859
  • 3. HTML Tables • Tables represent tabular data • A table consists of one or several rows • Each row has one or more columns • Tables comprised of several core tags: <table></table>: begin / end the table <tr></tr>: create a table row <td></td>: create tabular data (cell) • Tables should not be used for layout. Use CSS floats and positioning styles instead 2
  • 4. HTML Tables (2) • Start and end of a table • Start and end of a row • Start and end of a cell in a row 3 <table> ... </table> <tr> ... </tr> <td> ... </td>
  • 5. Simple HTML Tables – Example 4 <table cellspacing="0" cellpadding="5"> <tr> <td><img src="ppt.gif"></td> <td><a href="lecture1.ppt">Lecture 1</a></td> </tr> <tr> <td><img src="ppt.gif"></td> <td><a href="lecture2.ppt">Lecture 2</a></td> </tr> <tr> <td><img src="zip.gif"></td> <td><a href="lecture2-demos.zip"> Lecture 2 - Demos</a></td> </tr> </table>
  • 6. <table cellspacing="0" cellpadding="5"> <tr> <td><img src="ppt.gif"></td> <td><a href="lecture1.ppt">Lecture 1</a></td> </tr> <tr> <td><img src="ppt.gif"></td> <td><a href="lecture2.ppt">Lecture 2</a></td> </tr> <tr> <td><img src="zip.gif"></td> <td><a href="lecture2-demos.zip"> Lecture 2 - Demos</a></td> </tr> </table> Simple HTML Tables – Example (2) 5
  • 7. Complete HTML Tables • Table rows split into three semantic sections: header, body and footer • <thead> denotes table header and contains <th> elements, instead of <td> elements • <tbody> denotes collection of table rows that contain the very data • <tfoot> denotes table footer but comes BEFORE the <tbody> tag • <colgroup> and <col> define columns (most often used to set column widths) 6
  • 8. Complete HTML Table: Example 7 <table> <colgroup> <col style="width:100px" /><col /> </colgroup> <thead> <tr><th>Column 1</th><th>Column 2</th></tr> </thead> <tfoot> <tr><td>Footer 1</td><td>Footer 2</td></tr> </tfoot> <tbody> <tr><td>Cell 1.1</td><td>Cell 1.2</td></tr> <tr><td>Cell 2.1</td><td>Cell 2.2</td></tr> </tbody> </table> header footer Last comes the body (data) th columns
  • 9. <table> <colgroup> <col style="width:200px" /><col /> </colgroup> <thead> <tr><th>Column 1</th><th>Column 2</th></tr> </thead> <tfoot> <tr><td>Footer 1</td><td>Footer 2</td></tr> </tfoot> <tbody> <tr><td>Cell 1.1</td><td>Cell 1.2</td></tr> <tr><td>Cell 2.1</td><td>Cell 2.2</td></tr> </tbody> </table> Complete HTML Table: Example (2) 8 table-full.html Although the footer is before the data in the code, it is displayed last By default, header text is bold and centered.
  • 10. Nested Tables • Table data “cells” (<td>) can contain nested tables (tables within tables): 9 <table> <tr> <td>Contact:</td> <td> <table> <tr> <td>First Name</td> <td>Last Name</td> </tr> </table> </td> </tr> </table> nested-tables.html
  • 11.  cellpadding  Defines the empty space around the cell content  cellspacing  Defines the empty space between cells Cell Spacing and Padding • Tables have two important attributes: 10 cell cell cell cell cell cell cell cell
  • 12. Cell Spacing and Padding – Example 11 <html> <head><title>Table Cells</title></head> <body> <table cellspacing="15" cellpadding="0"> <tr><td>First</td> <td>Second</td></tr> </table> <br/> <table cellspacing="0" cellpadding="10"> <tr><td>First</td><td>Second</td></tr> </table> </body> </html> table-cells.html
  • 13. Cell Spacing and Padding – Example (2) 12 <html> <head><title>Table Cells</title></head> <body> <table cellspacing="15" cellpadding="0"> <tr><td>First</td> <td>Second</td></tr> </table> <br/> <table cellspacing="0" cellpadding="10"> <tr><td>First</td><td>Second</td></tr> </table> </body> </html> table-cells.html
  • 14.  rowspan  Defines how many rows the cell occupies  colspan  Defines how many columns the cell occupies Column and Row Span • Table cells have two important attributes: 13 cell[1,1] cell[1,2] cell[2,1] colspan="1" colspan="1" colspan="2" cell[1,1] cell[1,2] cell[2,1] rowspan="2" rowspan="1" rowspan="1"
  • 15. Column and Row Span – Example 14 <table cellspacing="0"> <tr class="1"><td>Cell[1,1]</td> <td colspan="2">Cell[2,1]</td></tr> <tr class=“2"><td>Cell[1,2]</td> <td rowspan="2">Cell[2,2]</td> <td>Cell[3,2]</td></tr> <tr class=“3"><td>Cell[1,3]</td> <td>Cell[2,3]</td></tr> </table> table-colspan-rowspan.html
  • 16. <table cellspacing="0"> <tr class="1"><td>Cell[1,1]</td> <td colspan="2">Cell[2,1]</td></tr> <tr class=“2"><td>Cell[1,2]</td> <td rowspan="2">Cell[2,2]</td> <td>Cell[3,2]</td></tr> <tr class=“3"><td>Cell[1,3]</td> <td>Cell[2,3]</td></tr> </table> Column and Row Span – Example (2) 15 table-colspan-rowspan.html Cell[2,3] Cell[1,3] Cell[3,2] Cell[2,2] Cell[1,2] Cell[2,1] Cell[1,1]
  • 17. HTML Forms Entering User Data from a Web Page
  • 18. HTML Forms • Forms are the primary method for gathering data from site visitors • Create a form block with • Example: 17 <form></form> <form name="myForm" method="post" action="path/to/some-script.php"> ... </form> The "action" attribute tells where the form data should be sent The “method" attribute tells how the form data should be sent – via GET or POST request
  • 19. Form Fields • Single-line text input fields: • Multi-line textarea fields: • Hidden fields contain data not shown to the user: • Often used by JavaScript code 18 <input type="text" name="FirstName" value="This is a text field" /> <textarea name="Comments">This is a multi-line text field</textarea> <input type="hidden" name="Account" value="This is a hidden text field" />
  • 20. Fieldsets • Fieldsets are used to enclose a group of related form fields: 19 <form method="post" action="form.aspx"> <fieldset> <legend>Client Details</legend> <input type="text" id="Name" /> <input type="text" id="Phone" /> </fieldset> <fieldset> <legend>Order Details</legend> <input type="text" id="Quantity" /> <textarea cols="40" rows="10" id="Remarks"></textarea> </fieldset> </form>
  • 21. Form Input Controls • Checkboxes: • Radio buttons: • Radio buttons can be grouped, allowing only one to be selected from a group: 20 <input type="checkbox" name="fruit" value="apple" /> <input type="radio" name="title" value="Mr." /> <input type="radio" name="city" value="Lom" /> <input type="radio" name="city" value="Ruse" />
  • 22. Other Form Controls • Dropdown menus: • Submit button: 21 <select name="gender"> <option value="Value 1" selected="selected">Male</option> <option value="Value 2">Female</option> <option value="Value 3">Other</option> </select> <input type="submit" name="submitBtn" value="Apply Now" />
  • 23. Other Form Controls (2) • Reset button – brings the form to its initial state • Image button – acts like submit but image is displayed and click coordinates are sent • Ordinary button – used for Javascript, no default action 22 <input type="reset" name="resetBtn" value="Reset the form" /> <input type="image" src="submit.gif" name="submitBtn" alt="Submit" /> <input type="button" value="click me" />
  • 24. Other Form Controls (3) • Password input – a text field which masks the entered text with * signs • Multiple select field – displays the list of items in multiple lines, instead of one 23 <input type="password" name="pass" /> <select name="products" multiple="multiple"> <option value="Value 1" selected="selected">keyboard</option> <option value="Value 2">mouse</option> <option value="Value 3">speakers</option> </select>
  • 25. Other Form Controls (4) • File input – a field used for uploading files • When used, it requires the form element to have a specific attribute: 24 <input type="file" name="photo" /> <form enctype="multipart/form-data"> ... <input type="file" name="photo" /> ... </form>
  • 26. Labels • Form labels are used to associate an explanatory text to a form field using the field's ID. • Clicking on a label focuses its associated field (checkboxes are toggled, radio buttons are checked) • Labels are both a usability and accessibility feature and are required in order to pass accessibility validation. 25 <label for="fn">First Name</label> <input type="text" id="fn" />
  • 27. HTML Forms – Example 26 <form method="post" action="apply-now.php"> <input name="subject" type="hidden" value="Class" /> <fieldset><legend>Academic information</legend> <label for="degree">Degree</label> <select name="degree" id="degree"> <option value="BA">Bachelor of Art</option> <option value="BS">Bachelor of Science</option> <option value="MBA" selected="selected">Master of Business Administration</option> </select> <br /> <label for="studentid">Student ID</label> <input type="password" name="studentid" /> </fieldset> <fieldset><legend>Personal Details</legend> <label for="fname">First Name</label> <input type="text" name="fname" id="fname" /> <br /> <label for="lname">Last Name</label> <input type="text" name="lname" id="lname" /> form.html
  • 28. HTML Forms – Example (2) 27 <br /> Gender: <input name="gender" type="radio" id="gm" value="m" /> <label for="gm">Male</label> <input name="gender" type="radio" id="gf" value="f" /> <label for="gf">Female</label> <br /> <label for="email">Email</label> <input type="text" name="email" id="email" /> </fieldset> <p> <textarea name="terms" cols="30" rows="4" readonly="readonly">TERMS AND CONDITIONS...</textarea> </p> <p> <input type="submit" name="submit" value="Send Form" /> <input type="reset" value="Clear Form" /> </p> </form> form.html (continued)
  • 29. form.html (continued) HTML Forms – Example (3) 28
  • 30. TabIndex • The tabindex HTML attribute controls the order in which form fields and hyperlinks are focused when repeatedly pressing the TAB key • tabindex="0" (zero) - "natural" order • If X > Y, then elements with tabindex="X" are iterated before elements with tabindex="Y" • Elements with negative tabindex are skipped, however, this is not defined in the standard 29 <input type="text" tabindex="10" />
  • 32. HTML Frames • Frames provide a way to show multiple HTML documents in a single Web page • The page can be split into separate views (frames) horizontally and vertically • Frames were popular in the early ages of HTML development, but now their usage is rejected • Frames are not supported by all user agents (browsers, search engines, etc.) • A <noframes> element is used to provide content for non-compatible agents. 31
  • 33. HTML Frames – Demo 32 <html> <head><title>Frames Example</title></head> <frameset cols="180px,*,150px"> <frame src="left.html" /> <frame src="middle.html" /> <frame src="right.html" /> </frameset> </html> frames.html  Note the target attribute applied to the <a> elements in the left frame.
  • 34. Inline Frames: <iframe> • Inline frames provide a way to show one website inside another website: 33 <iframe name="iframeGoogle" width="600" height="400" src="http://www.google.com" frameborder="yes" scrolling="yes"></iframe> iframe-demo.html
  • 35. Thank You For any concerns, please contact elearning@knust.edu.gh elearningknust@gmail.com 0322 191132 Jan 2014

Editor's Notes

  1. 07/16/96
  2. 07/16/96
  3. 07/16/96
  4. 07/16/96
  5. 07/16/96
  6. 07/16/96
  7. 07/16/96
  8. 07/16/96
  9. 07/16/96
  10. 07/16/96
  11. 07/16/96
  12. 07/16/96
  13. 07/16/96
  14. 07/16/96
  15. 07/16/96
  16. 07/16/96
  17. 07/16/96
  18. 07/16/96