SlideShare a Scribd company logo
Chapter 8
Creating Tables
and Forms
Web Design with
HTML5 & CSS3
8th Edition
• Define table elements
• Describe the steps used to plan, design, and code
a table
• Create a table with rows and data
• Insert a table caption
• Style a table for tablet and desktop viewports
• Describe form controls and their uses
Chapter 8: Creating Tables and Forms 2
Chapter Objectives
• Use the form and input elements
• Create text input controls, labels, and check boxes
• Create a selection menu with multiple options
• Use the textarea element
• Create a Submit button
• Create a Reset button
Chapter 8: Creating Tables and Forms 3
Chapter Objectives (continued)
• Tables
– Compare data or outline a detailed topic in a compact
format
– Consist of rows, columns, and cells
• Row – It is a horizontal line of information
• Column – It is a vertical line of information
Chapter 8: Creating Tables and Forms 4
Discovering Tables
• Cell
– It is the intersection of a row and a column and usually
contains data
– The two types of cell are: a heading cell or a data cell
oA heading cell displays text as bold and center-aligned
oA data cell displays normal, left-aligned text and contains
information appropriate for the column and row
Chapter 8: Creating Tables and Forms 5
Discovering Tables (continued 1)
• Figure 8–4 shows examples of the three elements:
rows, columns, and cells
Chapter 8: Creating Tables and Forms 6
Discovering Tables (continued 2)
• Table 8–1 lists the HTML elements used to create
a table
Chapter 8: Creating Tables and Forms 7
Creating a Table with HTML
Elements
• Creating a table on a webpage
– The <table> and </table> tags indicate the starting and
ending of a table
– The <tr> and </tr> tags indicate the starting and
ending of each table row
– The <td> and </td> tags indicate the starting and
ending tags for data elements within the table row
elements
Chapter 8: Creating Tables and Forms 8
Creating a Table with HTML
Elements (continued)
• Table border – It is the line that defines the
perimeter of the table
• Table header
– It is a heading cell and identifies the row or column
content
– It is defined with a starting <th> tag and an ending
</th> tag
Chapter 8: Creating Tables and Forms 9
Table Borders, Headers, and
Captions
• Table caption
– It is a descriptive text that serves as a title or identifies
the table’s purpose
– It is defined with a starting <caption> tag and an
ending </caption> tag
– It is inserted after the starting <table> tag
– A table can have only one caption
• Tables can include headers and captions
individually or in combination
Chapter 8: Creating Tables and Forms 10
Table Borders, Headers, and
Captions (continued 1)
• Figure 8–6 shows a table created with the
following code, which includes a table caption and
table headers
<table>
<caption>College Course
Recommendations by Semester</caption>
<tr>
<th>Semester 1</th>
<th>Semester 2</th>
<th>Semester 3</th>
<th>Semester 4</th>
</tr>
Chapter 8: Creating Tables and Forms 11
Table Borders, Headers, and
Captions (continued 2)
<tr>
<td>English I</td>
<td>English II</td>
<td>Spanish I</td>
<td>Spanish II</td>
</tr>
<tr>
<td>College Algebra</td>
<td>College Geometry</td>
<td>Calculus</td>
<td>Trigonometry</td>
Chapter 8: Creating Tables and Forms 12
Table Borders, Headers, and
Captions (continued 3)
</tr>
<tr>
<td>Physical Science</td>
<td>Biology</td>
<td>Humanities</td>
<td>World History</td>
</tr>
</table>
Chapter 8: Creating Tables and Forms 13
Table Borders, Headers, and
Captions (continued 4)
Chapter 8: Creating Tables and Forms 14
Table Borders, Headers, and
Captions (continued 5)
• Tables
– Display data in rows and columns
– Should not be used to design a layout for a webpage
– Help organize information so that it is easier for the
user to read
– Useful if the webpage needs to display a structured,
organized list of information
Chapter 8: Creating Tables and Forms 15
Use of Tables
• To create effective tables
– Plan the information that will appear in columns and
rows
– Create a design that presents the information clearly
• When planning a table for responsive web design,
give careful consideration to the mobile viewport
because of its screen size
Chapter 8: Creating Tables and Forms 16
Planning the Table
Chapter 8: Creating Tables and Forms 17
To Add a Table Element to the
Classes Page
Chapter 8: Creating Tables and Forms 18
Styling Table Elements
• Separated border
– When a border is applied to table elements, by
default, each cell has its own border, making the table
appear to use double lines between each table data
cell
• Collapsed border
– Use the border-collapse property with a value of
collapse to display a table with single, consolidated
borders
Chapter 8: Creating Tables and Forms 19
Styling Table Elements
(continued)
Chapter 8: Creating Tables and Forms 20
To Style a Table for a Tablet
Viewport
Chapter 8: Creating Tables and Forms 21
To Style a Table for a Tablet
Viewport (continued 1)
Chapter 8: Creating Tables and Forms 22
To Style a Table for a Tablet
Viewport (continued 2)
Chapter 8: Creating Tables and Forms 23
To Style a Table for a Tablet
Viewport (continued 3)
Chapter 8: Creating Tables and Forms 24
To Style a Table for a Desktop
Viewport
Chapter 8: Creating Tables and Forms 25
To Style a Table for a Desktop
Viewport (continued 1)
Chapter 8: Creating Tables and Forms 26
To Style a Table for a Desktop
Viewport (continued 2)
• Forms provide a structured way to collect
information from webpage visitors
• Visitors complete webpage forms to register for
an account or to make a purchase.
• Businesses use forms to gather visitor or customer
information and store it in a database for future
use
Chapter 8: Creating Tables and Forms 27
Creating Webpage Forms
• All form elements are contained with the starting
<form> tag and the ending </form> tag
• Input control – It is an interactive mechanism for
users to enter text or make selections on a form
– A label is text describing the type of information to
enter with an input control.
• Most controls in an HTML form are defined by
using the type attribute of the input element
Chapter 8: Creating Tables and Forms 28
Form Controls
• Define other controls using separate elements,
such as the textarea and select elements
• The two input controls are:
– Data input control – It is used to make a selection or
perform a command
– Text input control – It accepts text, such as names,
dates, and passwords, and is called an input field
Chapter 8: Creating Tables and Forms 29
Form Controls (continued 1)
Chapter 8: Creating Tables and Forms 30
Form Controls (continued 2)
• Each input control has attributes that are used
more frequently than the others:
– name – It identifies the specific information that is
being sent when the form is submitted for processing.
All controls have a name
– id – It provides a unique ID for the element. Use the
id attribute with input controls
– value – It specifies the value of an input element and
varies depending on input type
Chapter 8: Creating Tables and Forms 31
Form Controls (continued 3)
• Common input controls used with a form include
text, password, email, checkbox, select, submit,
reset, etc.
• Text input controls include the following types:
– text box (text control), for small amounts of text
– password text box (password control), for entering a
password
– email text box (email control), for entering an email
address
Chapter 8: Creating Tables and Forms 32
Form Controls (continued 4)
– telephone text box (tel control), for entering a
telephone number
– date text box (date control), for entering a date
– text area box (textarea control), for larger amounts of
text
• These text input controls have two frequently
used attributes:
– size – It determines the width of the control in
characters
– maxlength – It specifies the maximum number of
characters accepted
Chapter 8: Creating Tables and Forms 33
Form Controls (continued 5)
– Example:
oThe first line of the following code creates a 25-character
text box for the user’s last name and the second line creates
an eight-character text box for the user’s password:
<p>Last Name: <input
name="lastname" type="text"
size="25"></p>
<p>Password: <input name="password
type="password" size="8"></p>
Chapter 8: Creating Tables and Forms 34
Form Controls (continued 6)
• Password control – It is a text control as it
provides a text box for the password a visitor
enters
• Email control – It is a text box where visitors enter
an email address
• Tel control – It is a text box where visitors enter a
telephone number
• Date control – It is a text box that accepts a date
Chapter 8: Creating Tables and Forms 35
Form Controls (continued 7)
• Textarea control – It creates a text box that allows
multiple lines of input
– To create a textarea control, use the textarea
element instead of the input element
– It has two primary attributes, which set the size of the
textarea control:
orows, which specifies the number of rows, or lines, in the
textarea control
ocols, which sets the width of the textarea control as the
number of columns, with each column containing one
character
Chapter 8: Creating Tables and Forms 36
Form Controls (continued 8)
oThe following is an example of HTML code defining a
textarea control:
<label>What products would you like
to see us offer?</label>
<textarea name="feedback" rows="3"
cols="100"></textarea>
Chapter 8: Creating Tables and Forms 37
Form Controls (continued 9)
• Checkbox control
– It allows a webpage visitor to select items from a list of
one or more choices
– The following code is an example for two checkbox
controls that might appear on a form for a grocery
store website
<input name="fruit" type="checkbox"
value="apple“ checked="checked">Apple
<input name="fruit" type="checkbox"
value="peach">Peach
Chapter 8: Creating Tables and Forms 38
Form Controls (continued 10)
• Radio control
– It limits the webpage visitor to only one choice from a
list of choices
– Each choice has a radio button, or option button,
which appears as an open circle
– By default, all radio buttons are deselected
– To set a particular button as the default, use the
checked attribute and value within the <input> tag
Chapter 8: Creating Tables and Forms 39
Form Controls (continued 11)
– The following is sample code to create two radio
controls that might appear in a rental car website
form:
<input name="car" type="radio"
checked="checked" value="car">Car
<input name="truck" type="radio"
value="truck">Truck
– A visitor can choose to rent a car or a truck, with the
Car radio button already selected when the form
opens
Chapter 8: Creating Tables and Forms 40
Form Controls (continued 12)
• Select control
– It creates a selection menu from which the visitor
makes one or more choices and is suitable when a
limited number of choices are available
– It appears on a form as a text box with a list arrow
– The following is sample code for a select control:
<select name="station">
<option>Pandora</option>
<option>Internet Radio</option>
<option>Live365</option>
<option>Jango</option>
</select>
Chapter 8: Creating Tables and Forms 41
Form Controls (continued 13)
• Submit button
– It sends the form information to the appropriate
location for processing
– When it is clicked on the form, the name of each
control and the value of its data are sent to the server
to be processed
– The submit control is created with the following code:
<input type="submit“ value="Submit">
Chapter 8: Creating Tables and Forms 42
Form Controls (continued 14)
• Reset button
– Clears any input entered in the form, resetting the
input controls to their defaults
– A webpage form must include a submit control and a
reset control
– The value attribute specifies the text that appears
on the button
– The reset control is created with the following code:
<input type="reset" value="Reset">
Chapter 8: Creating Tables and Forms 43
Form Controls (continued 15)
• Figure 8–34 shows an example of a form with
several input controls, including text, email, tel,
date, select, and textarea
Chapter 8: Creating Tables and Forms 44
Form Controls (continued 16)
• Form Labels
– They identify the type of information to enter into or
select from an input control
– They are added to a form using the label element
– To connect them to their controls, include the for
attribute with the same value as the input control’s id
value
Chapter 8: Creating Tables and Forms 45
Form Controls (continued 17)
– The following code creates a label and a text box for a
visitor’s first name:
<label for="fName">First Name:</label>
<input type="text" name="fName“
id="fName">
Chapter 8: Creating Tables and Forms 46
Form Controls (continued 18)
Chapter 8: Creating Tables and Forms 47
Form Controls (continued 19)
Chapter 8: Creating Tables and Forms 48
Form Controls (continued 20)
• action
– It is an attribute of the <form> tag that specifies the
browser’s action when submitting the form
• Common Gateway Interface (CGI) script
– It communicates with the web server and sends the
information on the webpage form to the server for
processing
Chapter 8: Creating Tables and Forms 49
Form Processing
• method
– It is an attribute of the <form> tag that specifies how
to send the data entered in the form to the server to
be processed
• Get method
– It appends the name-value pairs to the URL indicated
in the action attribute
– Example of a form tag with the get method and
specified action is as follows:
<form method="GET“ action="formInfo.php">
Chapter 8: Creating Tables and Forms 50
Form Processing (continued 1)
• Post method
– It sends a separate data file with the name-value pairs
to the URL indicated in the action attribute
– It is used very commonly because it can be used to
send sensitive form data and does not have a size
limitation
– Example of a form tag with the post method and
specified action is as follows:
<form method="POST“ action="formInfo.php">
Chapter 8: Creating Tables and Forms 51
Form Processing (continued 2)
• CSS styles are applied to forms to improve the
appeal and usefulness of the form and its controls
• As with tables, consider forms in the context of
responsive design
• Controls can be included to collect optional
information, such as product feedback, in tablet
and desktop viewports
Chapter 8: Creating Tables and Forms 52
Styling Forms
Chapter 8: Creating Tables and Forms 53
To Style a Form for a Desktop
Viewport
Chapter 8: Creating Tables and Forms 54
To Style a Form for a Desktop
Viewport (continued)
Chapter 8 Complete
HTML5 & CSS3
8th Edition

More Related Content

What's hot (20)

Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZerStd 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Nuzhat Memon
 
Css
CssCss
Css
Hemant Saini
 
HTML/HTML5
HTML/HTML5HTML/HTML5
HTML/HTML5
People Strategists
 
Html,javascript & css
Html,javascript & cssHtml,javascript & css
Html,javascript & css
Predhin Sapru
 
Html frames
Html framesHtml frames
Html frames
eShikshak
 
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner
Jayapal Reddy Nimmakayala
 
CSS
CSSCSS
CSS
People Strategists
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Ravinder Kamboj
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
Doris Chen
 
Page layout with css
Page layout with cssPage layout with css
Page layout with css
Er. Nawaraj Bhandari
 
ASP.NET Web form
ASP.NET Web formASP.NET Web form
ASP.NET Web form
Md. Mahedee Hasan
 
Css Ppt
Css PptCss Ppt
Css Ppt
Hema Prasanth
 
HTML and CSS crash course!
HTML and CSS crash course!HTML and CSS crash course!
HTML and CSS crash course!
Ana Cidre
 
Links in Html
Links in HtmlLinks in Html
Links in Html
sadeenedian08
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
Eliran Eliassy
 
HTML & CSS: Chapter 06
HTML & CSS: Chapter 06HTML & CSS: Chapter 06
HTML & CSS: Chapter 06
Steve Guinan
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
abhilashagupta
 
Server Controls of ASP.Net
Server Controls of ASP.NetServer Controls of ASP.Net
Server Controls of ASP.Net
Hitesh Santani
 
Eye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easilyEye catching HTML BASICS tips: Learn easily
Eye catching HTML BASICS tips: Learn easily
shabab shihan
 

Viewers also liked (19)

HTML: Chapter 01
HTML: Chapter 01HTML: Chapter 01
HTML: Chapter 01
Steve Guinan
 
Intro To ECAT
Intro To ECATIntro To ECAT
Intro To ECAT
cloeven
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
application developer
 
Chapter 25
Chapter 25Chapter 25
Chapter 25
application developer
 
CSS
CSSCSS
CSS
Akila Iroshan
 
CSS3 notes
CSS3 notesCSS3 notes
CSS3 notes
Rex Wang
 
Chapter 19
Chapter 19Chapter 19
Chapter 19
application developer
 
Elements of Design
Elements of DesignElements of Design
Elements of Design
Steve Guinan
 
CSS - Basics
CSS - BasicsCSS - Basics
CSS - Basics
Shubham_Saurabh
 
Unit 6, Lesson 3 - Vectors
Unit 6, Lesson 3 - VectorsUnit 6, Lesson 3 - Vectors
Unit 6, Lesson 3 - Vectors
judan1970
 
Bread board
Bread boardBread board
Bread board
André Walker
 
Breadboard
BreadboardBreadboard
Breadboard
EMEC101
 
Basic css
Basic cssBasic css
Basic css
Gopinath Ambothi
 
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS Properties
Nosheen Qamar
 
Vernier caliper
Vernier caliperVernier caliper
Vernier caliper
Abinashpapu
 
Spline Interpolation
Spline InterpolationSpline Interpolation
Spline Interpolation
aiQUANT
 
Interpolation and extrapolation
Interpolation and extrapolationInterpolation and extrapolation
Interpolation and extrapolation
Aswin Pv
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
Sun Technlogies
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
 
Ad

Similar to HTML5 &CSS: Chapter 08 (20)

Web Design & Development - Session 4
Web Design & Development - Session 4Web Design & Development - Session 4
Web Design & Development - Session 4
Shahrzad Peyman
 
WEB MODULE 2.pdf
WEB MODULE 2.pdfWEB MODULE 2.pdf
WEB MODULE 2.pdf
Deepika A B
 
HTML Tables and Forms
HTML Tables and Forms HTML Tables and Forms
HTML Tables and Forms
Hinesh Miyani
 
Html
HtmlHtml
Html
baabtra.com - No. 1 supplier of quality freshers
 
29042023.pptx
29042023.pptx29042023.pptx
29042023.pptx
srinivasa gowda
 
Tables and their padding in HTML etc.pptx
Tables and their padding in HTML etc.pptxTables and their padding in HTML etc.pptx
Tables and their padding in HTML etc.pptx
SALT13
 
Html - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik AcademyHtml - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik Academy
Ognyan Penkov
 
Table and Form HTML&CSS
Table and Form HTML&CSSTable and Form HTML&CSS
Table and Form HTML&CSS
Yaowaluck Promdee
 
Section1 HTML (part2) Web technology for b
Section1 HTML (part2) Web technology for bSection1 HTML (part2) Web technology for b
Section1 HTML (part2) Web technology for b
salmamontaser1
 
Lesson 5 cs5
Lesson 5   cs5Lesson 5   cs5
Lesson 5 cs5
dtelepos
 
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
FYBSC IT Web Programming Unit II  Html 5 Tables, Forms and MediaFYBSC IT Web Programming Unit II  Html 5 Tables, Forms and Media
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
Arti Parab Academics
 
2. Lecture 2 WT - Lists, Tables, and Forms.pptx
2. Lecture 2 WT - Lists, Tables, and Forms.pptx2. Lecture 2 WT - Lists, Tables, and Forms.pptx
2. Lecture 2 WT - Lists, Tables, and Forms.pptx
tavgaqasim8
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
club23
 
Forms.pptx
Forms.pptxForms.pptx
Forms.pptx
venugopalcharry1921
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
BG Java EE Course
 
creating tables in website design and interface
creating tables in website design and interfacecreating tables in website design and interface
creating tables in website design and interface
clement swarnappa
 
Ddpz2613 topic4 table
Ddpz2613 topic4 tableDdpz2613 topic4 table
Ddpz2613 topic4 table
Mohamad Sahiedan
 
Lectuer html2
Lectuer  html2Lectuer  html2
Lectuer html2
Nawal Alragawi
 
Tables in databases - Relationships and diagrams
Tables in  databases - Relationships and diagramsTables in  databases - Relationships and diagrams
Tables in databases - Relationships and diagrams
clement swarnappa
 
Web(chap2)
Web(chap2)Web(chap2)
Web(chap2)
Jafar Nesargi
 
Web Design & Development - Session 4
Web Design & Development - Session 4Web Design & Development - Session 4
Web Design & Development - Session 4
Shahrzad Peyman
 
WEB MODULE 2.pdf
WEB MODULE 2.pdfWEB MODULE 2.pdf
WEB MODULE 2.pdf
Deepika A B
 
HTML Tables and Forms
HTML Tables and Forms HTML Tables and Forms
HTML Tables and Forms
Hinesh Miyani
 
Tables and their padding in HTML etc.pptx
Tables and their padding in HTML etc.pptxTables and their padding in HTML etc.pptx
Tables and their padding in HTML etc.pptx
SALT13
 
Html - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik AcademyHtml - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik Academy
Ognyan Penkov
 
Section1 HTML (part2) Web technology for b
Section1 HTML (part2) Web technology for bSection1 HTML (part2) Web technology for b
Section1 HTML (part2) Web technology for b
salmamontaser1
 
Lesson 5 cs5
Lesson 5   cs5Lesson 5   cs5
Lesson 5 cs5
dtelepos
 
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
FYBSC IT Web Programming Unit II  Html 5 Tables, Forms and MediaFYBSC IT Web Programming Unit II  Html 5 Tables, Forms and Media
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
Arti Parab Academics
 
2. Lecture 2 WT - Lists, Tables, and Forms.pptx
2. Lecture 2 WT - Lists, Tables, and Forms.pptx2. Lecture 2 WT - Lists, Tables, and Forms.pptx
2. Lecture 2 WT - Lists, Tables, and Forms.pptx
tavgaqasim8
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
club23
 
creating tables in website design and interface
creating tables in website design and interfacecreating tables in website design and interface
creating tables in website design and interface
clement swarnappa
 
Tables in databases - Relationships and diagrams
Tables in  databases - Relationships and diagramsTables in  databases - Relationships and diagrams
Tables in databases - Relationships and diagrams
clement swarnappa
 
Ad

More from Steve Guinan (20)

Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and Animation
Steve Guinan
 
Chapter 17: Responsive Web Design
Chapter 17: Responsive Web DesignChapter 17: Responsive Web Design
Chapter 17: Responsive Web Design
Steve Guinan
 
Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning
Steve Guinan
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
Steve Guinan
 
Chapter 8: Tables
Chapter 8: TablesChapter 8: Tables
Chapter 8: Tables
Steve Guinan
 
Chapter 14: Box Model
Chapter 14: Box ModelChapter 14: Box Model
Chapter 14: Box Model
Steve Guinan
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
Steve Guinan
 
Chapter 12: CSS Part 2
Chapter 12: CSS Part 2Chapter 12: CSS Part 2
Chapter 12: CSS Part 2
Steve Guinan
 
Chapter 11: Intro to CSS
Chapter 11: Intro to CSSChapter 11: Intro to CSS
Chapter 11: Intro to CSS
Steve Guinan
 
Chapter 23: Web Images
Chapter 23: Web ImagesChapter 23: Web Images
Chapter 23: Web Images
Steve Guinan
 
Chapter 7: Images
Chapter 7: ImagesChapter 7: Images
Chapter 7: Images
Steve Guinan
 
HubSpot Student Instructions
HubSpot Student InstructionsHubSpot Student Instructions
HubSpot Student Instructions
Steve Guinan
 
Ch 6: Links
Ch 6: LinksCh 6: Links
Ch 6: Links
Steve Guinan
 
Ch 5: Marking up Text
Ch 5: Marking up TextCh 5: Marking up Text
Ch 5: Marking up Text
Steve Guinan
 
Ch 3: Big Concepts
Ch 3: Big ConceptsCh 3: Big Concepts
Ch 3: Big Concepts
Steve Guinan
 
Ch 2: How the Web Works
Ch 2: How the Web WorksCh 2: How the Web Works
Ch 2: How the Web Works
Steve Guinan
 
Ch 1: Getting Started
Ch 1: Getting StartedCh 1: Getting Started
Ch 1: Getting Started
Steve Guinan
 
Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7
Steve Guinan
 
Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6
Steve Guinan
 
Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5
Steve Guinan
 
Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and Animation
Steve Guinan
 
Chapter 17: Responsive Web Design
Chapter 17: Responsive Web DesignChapter 17: Responsive Web Design
Chapter 17: Responsive Web Design
Steve Guinan
 
Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning Chapter 15: Floating and Positioning
Chapter 15: Floating and Positioning
Steve Guinan
 
Chapter 14: Box Model
Chapter 14: Box ModelChapter 14: Box Model
Chapter 14: Box Model
Steve Guinan
 
Chapter 13: Colors and Backgrounds
Chapter 13: Colors and BackgroundsChapter 13: Colors and Backgrounds
Chapter 13: Colors and Backgrounds
Steve Guinan
 
Chapter 12: CSS Part 2
Chapter 12: CSS Part 2Chapter 12: CSS Part 2
Chapter 12: CSS Part 2
Steve Guinan
 
Chapter 11: Intro to CSS
Chapter 11: Intro to CSSChapter 11: Intro to CSS
Chapter 11: Intro to CSS
Steve Guinan
 
Chapter 23: Web Images
Chapter 23: Web ImagesChapter 23: Web Images
Chapter 23: Web Images
Steve Guinan
 
HubSpot Student Instructions
HubSpot Student InstructionsHubSpot Student Instructions
HubSpot Student Instructions
Steve Guinan
 
Ch 5: Marking up Text
Ch 5: Marking up TextCh 5: Marking up Text
Ch 5: Marking up Text
Steve Guinan
 
Ch 3: Big Concepts
Ch 3: Big ConceptsCh 3: Big Concepts
Ch 3: Big Concepts
Steve Guinan
 
Ch 2: How the Web Works
Ch 2: How the Web WorksCh 2: How the Web Works
Ch 2: How the Web Works
Steve Guinan
 
Ch 1: Getting Started
Ch 1: Getting StartedCh 1: Getting Started
Ch 1: Getting Started
Steve Guinan
 
Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7Intro to Web Design 6e Chapter 7
Intro to Web Design 6e Chapter 7
Steve Guinan
 
Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6Intro to Web Design 6e Chapter 6
Intro to Web Design 6e Chapter 6
Steve Guinan
 
Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5Intro to Web Design 6e Chapter 5
Intro to Web Design 6e Chapter 5
Steve Guinan
 

Recently uploaded (20)

Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil DisobediencePaper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
LDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student NewsLDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student News
LDM & Mia eStudios
 
What are the benefits that dance brings?
What are the benefits that dance brings?What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptxRai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive LearningSustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Rajdeep Bavaliya
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptxSPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdfIntroduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Overview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo SlidesOverview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo Slides
Celine George
 
Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...
Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...
Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...
Himalayan Group of Professional Institutions (HGPI)
 
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Chalukyas of Gujrat, Solanki Dynasty NEP.pptxChalukyas of Gujrat, Solanki Dynasty NEP.pptx
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
ABCs of Bookkeeping for Nonprofits TechSoup.pdfABCs of Bookkeeping for Nonprofits TechSoup.pdf
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
TechSoup
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil DisobediencePaper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
LDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student NewsLDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student News
LDM & Mia eStudios
 
What are the benefits that dance brings?
What are the benefits that dance brings?What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive LearningSustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Rajdeep Bavaliya
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptxSPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdfIntroduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Overview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo SlidesOverview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo Slides
Celine George
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
ABCs of Bookkeeping for Nonprofits TechSoup.pdfABCs of Bookkeeping for Nonprofits TechSoup.pdf
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
TechSoup
 

HTML5 &CSS: Chapter 08

  • 1. Chapter 8 Creating Tables and Forms Web Design with HTML5 & CSS3 8th Edition
  • 2. • Define table elements • Describe the steps used to plan, design, and code a table • Create a table with rows and data • Insert a table caption • Style a table for tablet and desktop viewports • Describe form controls and their uses Chapter 8: Creating Tables and Forms 2 Chapter Objectives
  • 3. • Use the form and input elements • Create text input controls, labels, and check boxes • Create a selection menu with multiple options • Use the textarea element • Create a Submit button • Create a Reset button Chapter 8: Creating Tables and Forms 3 Chapter Objectives (continued)
  • 4. • Tables – Compare data or outline a detailed topic in a compact format – Consist of rows, columns, and cells • Row – It is a horizontal line of information • Column – It is a vertical line of information Chapter 8: Creating Tables and Forms 4 Discovering Tables
  • 5. • Cell – It is the intersection of a row and a column and usually contains data – The two types of cell are: a heading cell or a data cell oA heading cell displays text as bold and center-aligned oA data cell displays normal, left-aligned text and contains information appropriate for the column and row Chapter 8: Creating Tables and Forms 5 Discovering Tables (continued 1)
  • 6. • Figure 8–4 shows examples of the three elements: rows, columns, and cells Chapter 8: Creating Tables and Forms 6 Discovering Tables (continued 2)
  • 7. • Table 8–1 lists the HTML elements used to create a table Chapter 8: Creating Tables and Forms 7 Creating a Table with HTML Elements
  • 8. • Creating a table on a webpage – The <table> and </table> tags indicate the starting and ending of a table – The <tr> and </tr> tags indicate the starting and ending of each table row – The <td> and </td> tags indicate the starting and ending tags for data elements within the table row elements Chapter 8: Creating Tables and Forms 8 Creating a Table with HTML Elements (continued)
  • 9. • Table border – It is the line that defines the perimeter of the table • Table header – It is a heading cell and identifies the row or column content – It is defined with a starting <th> tag and an ending </th> tag Chapter 8: Creating Tables and Forms 9 Table Borders, Headers, and Captions
  • 10. • Table caption – It is a descriptive text that serves as a title or identifies the table’s purpose – It is defined with a starting <caption> tag and an ending </caption> tag – It is inserted after the starting <table> tag – A table can have only one caption • Tables can include headers and captions individually or in combination Chapter 8: Creating Tables and Forms 10 Table Borders, Headers, and Captions (continued 1)
  • 11. • Figure 8–6 shows a table created with the following code, which includes a table caption and table headers <table> <caption>College Course Recommendations by Semester</caption> <tr> <th>Semester 1</th> <th>Semester 2</th> <th>Semester 3</th> <th>Semester 4</th> </tr> Chapter 8: Creating Tables and Forms 11 Table Borders, Headers, and Captions (continued 2)
  • 12. <tr> <td>English I</td> <td>English II</td> <td>Spanish I</td> <td>Spanish II</td> </tr> <tr> <td>College Algebra</td> <td>College Geometry</td> <td>Calculus</td> <td>Trigonometry</td> Chapter 8: Creating Tables and Forms 12 Table Borders, Headers, and Captions (continued 3)
  • 13. </tr> <tr> <td>Physical Science</td> <td>Biology</td> <td>Humanities</td> <td>World History</td> </tr> </table> Chapter 8: Creating Tables and Forms 13 Table Borders, Headers, and Captions (continued 4)
  • 14. Chapter 8: Creating Tables and Forms 14 Table Borders, Headers, and Captions (continued 5)
  • 15. • Tables – Display data in rows and columns – Should not be used to design a layout for a webpage – Help organize information so that it is easier for the user to read – Useful if the webpage needs to display a structured, organized list of information Chapter 8: Creating Tables and Forms 15 Use of Tables
  • 16. • To create effective tables – Plan the information that will appear in columns and rows – Create a design that presents the information clearly • When planning a table for responsive web design, give careful consideration to the mobile viewport because of its screen size Chapter 8: Creating Tables and Forms 16 Planning the Table
  • 17. Chapter 8: Creating Tables and Forms 17 To Add a Table Element to the Classes Page
  • 18. Chapter 8: Creating Tables and Forms 18 Styling Table Elements
  • 19. • Separated border – When a border is applied to table elements, by default, each cell has its own border, making the table appear to use double lines between each table data cell • Collapsed border – Use the border-collapse property with a value of collapse to display a table with single, consolidated borders Chapter 8: Creating Tables and Forms 19 Styling Table Elements (continued)
  • 20. Chapter 8: Creating Tables and Forms 20 To Style a Table for a Tablet Viewport
  • 21. Chapter 8: Creating Tables and Forms 21 To Style a Table for a Tablet Viewport (continued 1)
  • 22. Chapter 8: Creating Tables and Forms 22 To Style a Table for a Tablet Viewport (continued 2)
  • 23. Chapter 8: Creating Tables and Forms 23 To Style a Table for a Tablet Viewport (continued 3)
  • 24. Chapter 8: Creating Tables and Forms 24 To Style a Table for a Desktop Viewport
  • 25. Chapter 8: Creating Tables and Forms 25 To Style a Table for a Desktop Viewport (continued 1)
  • 26. Chapter 8: Creating Tables and Forms 26 To Style a Table for a Desktop Viewport (continued 2)
  • 27. • Forms provide a structured way to collect information from webpage visitors • Visitors complete webpage forms to register for an account or to make a purchase. • Businesses use forms to gather visitor or customer information and store it in a database for future use Chapter 8: Creating Tables and Forms 27 Creating Webpage Forms
  • 28. • All form elements are contained with the starting <form> tag and the ending </form> tag • Input control – It is an interactive mechanism for users to enter text or make selections on a form – A label is text describing the type of information to enter with an input control. • Most controls in an HTML form are defined by using the type attribute of the input element Chapter 8: Creating Tables and Forms 28 Form Controls
  • 29. • Define other controls using separate elements, such as the textarea and select elements • The two input controls are: – Data input control – It is used to make a selection or perform a command – Text input control – It accepts text, such as names, dates, and passwords, and is called an input field Chapter 8: Creating Tables and Forms 29 Form Controls (continued 1)
  • 30. Chapter 8: Creating Tables and Forms 30 Form Controls (continued 2)
  • 31. • Each input control has attributes that are used more frequently than the others: – name – It identifies the specific information that is being sent when the form is submitted for processing. All controls have a name – id – It provides a unique ID for the element. Use the id attribute with input controls – value – It specifies the value of an input element and varies depending on input type Chapter 8: Creating Tables and Forms 31 Form Controls (continued 3)
  • 32. • Common input controls used with a form include text, password, email, checkbox, select, submit, reset, etc. • Text input controls include the following types: – text box (text control), for small amounts of text – password text box (password control), for entering a password – email text box (email control), for entering an email address Chapter 8: Creating Tables and Forms 32 Form Controls (continued 4)
  • 33. – telephone text box (tel control), for entering a telephone number – date text box (date control), for entering a date – text area box (textarea control), for larger amounts of text • These text input controls have two frequently used attributes: – size – It determines the width of the control in characters – maxlength – It specifies the maximum number of characters accepted Chapter 8: Creating Tables and Forms 33 Form Controls (continued 5)
  • 34. – Example: oThe first line of the following code creates a 25-character text box for the user’s last name and the second line creates an eight-character text box for the user’s password: <p>Last Name: <input name="lastname" type="text" size="25"></p> <p>Password: <input name="password type="password" size="8"></p> Chapter 8: Creating Tables and Forms 34 Form Controls (continued 6)
  • 35. • Password control – It is a text control as it provides a text box for the password a visitor enters • Email control – It is a text box where visitors enter an email address • Tel control – It is a text box where visitors enter a telephone number • Date control – It is a text box that accepts a date Chapter 8: Creating Tables and Forms 35 Form Controls (continued 7)
  • 36. • Textarea control – It creates a text box that allows multiple lines of input – To create a textarea control, use the textarea element instead of the input element – It has two primary attributes, which set the size of the textarea control: orows, which specifies the number of rows, or lines, in the textarea control ocols, which sets the width of the textarea control as the number of columns, with each column containing one character Chapter 8: Creating Tables and Forms 36 Form Controls (continued 8)
  • 37. oThe following is an example of HTML code defining a textarea control: <label>What products would you like to see us offer?</label> <textarea name="feedback" rows="3" cols="100"></textarea> Chapter 8: Creating Tables and Forms 37 Form Controls (continued 9)
  • 38. • Checkbox control – It allows a webpage visitor to select items from a list of one or more choices – The following code is an example for two checkbox controls that might appear on a form for a grocery store website <input name="fruit" type="checkbox" value="apple“ checked="checked">Apple <input name="fruit" type="checkbox" value="peach">Peach Chapter 8: Creating Tables and Forms 38 Form Controls (continued 10)
  • 39. • Radio control – It limits the webpage visitor to only one choice from a list of choices – Each choice has a radio button, or option button, which appears as an open circle – By default, all radio buttons are deselected – To set a particular button as the default, use the checked attribute and value within the <input> tag Chapter 8: Creating Tables and Forms 39 Form Controls (continued 11)
  • 40. – The following is sample code to create two radio controls that might appear in a rental car website form: <input name="car" type="radio" checked="checked" value="car">Car <input name="truck" type="radio" value="truck">Truck – A visitor can choose to rent a car or a truck, with the Car radio button already selected when the form opens Chapter 8: Creating Tables and Forms 40 Form Controls (continued 12)
  • 41. • Select control – It creates a selection menu from which the visitor makes one or more choices and is suitable when a limited number of choices are available – It appears on a form as a text box with a list arrow – The following is sample code for a select control: <select name="station"> <option>Pandora</option> <option>Internet Radio</option> <option>Live365</option> <option>Jango</option> </select> Chapter 8: Creating Tables and Forms 41 Form Controls (continued 13)
  • 42. • Submit button – It sends the form information to the appropriate location for processing – When it is clicked on the form, the name of each control and the value of its data are sent to the server to be processed – The submit control is created with the following code: <input type="submit“ value="Submit"> Chapter 8: Creating Tables and Forms 42 Form Controls (continued 14)
  • 43. • Reset button – Clears any input entered in the form, resetting the input controls to their defaults – A webpage form must include a submit control and a reset control – The value attribute specifies the text that appears on the button – The reset control is created with the following code: <input type="reset" value="Reset"> Chapter 8: Creating Tables and Forms 43 Form Controls (continued 15)
  • 44. • Figure 8–34 shows an example of a form with several input controls, including text, email, tel, date, select, and textarea Chapter 8: Creating Tables and Forms 44 Form Controls (continued 16)
  • 45. • Form Labels – They identify the type of information to enter into or select from an input control – They are added to a form using the label element – To connect them to their controls, include the for attribute with the same value as the input control’s id value Chapter 8: Creating Tables and Forms 45 Form Controls (continued 17)
  • 46. – The following code creates a label and a text box for a visitor’s first name: <label for="fName">First Name:</label> <input type="text" name="fName“ id="fName"> Chapter 8: Creating Tables and Forms 46 Form Controls (continued 18)
  • 47. Chapter 8: Creating Tables and Forms 47 Form Controls (continued 19)
  • 48. Chapter 8: Creating Tables and Forms 48 Form Controls (continued 20)
  • 49. • action – It is an attribute of the <form> tag that specifies the browser’s action when submitting the form • Common Gateway Interface (CGI) script – It communicates with the web server and sends the information on the webpage form to the server for processing Chapter 8: Creating Tables and Forms 49 Form Processing
  • 50. • method – It is an attribute of the <form> tag that specifies how to send the data entered in the form to the server to be processed • Get method – It appends the name-value pairs to the URL indicated in the action attribute – Example of a form tag with the get method and specified action is as follows: <form method="GET“ action="formInfo.php"> Chapter 8: Creating Tables and Forms 50 Form Processing (continued 1)
  • 51. • Post method – It sends a separate data file with the name-value pairs to the URL indicated in the action attribute – It is used very commonly because it can be used to send sensitive form data and does not have a size limitation – Example of a form tag with the post method and specified action is as follows: <form method="POST“ action="formInfo.php"> Chapter 8: Creating Tables and Forms 51 Form Processing (continued 2)
  • 52. • CSS styles are applied to forms to improve the appeal and usefulness of the form and its controls • As with tables, consider forms in the context of responsive design • Controls can be included to collect optional information, such as product feedback, in tablet and desktop viewports Chapter 8: Creating Tables and Forms 52 Styling Forms
  • 53. Chapter 8: Creating Tables and Forms 53 To Style a Form for a Desktop Viewport
  • 54. Chapter 8: Creating Tables and Forms 54 To Style a Form for a Desktop Viewport (continued)
  • 55. Chapter 8 Complete HTML5 & CSS3 8th Edition