Module 2 - HTML Tables Forms - Part 2
Module 2 - HTML Tables Forms - Part 2
and Forms
Chapter 5
1 Introducing
Tables 2 Styling Tables
3 Introducing
Forms 4 Form Control
Elements
7
Summary
HTML Tables
A grid of cells
th
• Popular in 1990s
• Results in table bloat
• Not semantic
• Larger HTML pages
• Longer load time
1 Introducing
Tables 2 Styling Tables
3 Introducing
Forms 4 Form Control
Elements
7 8
Summary
Styling Tables
The old ways deprecated
1 Introducing
Tables 2 Styling Tables
3 Introducing
Forms 4 Form Control
Elements
7 8
Summary
HTML
Forms
Richer way to interact with server
Forms provide the user with an alternative way to
interact with a web server.
• Forms provide rich mechanisms like:
• Text input : Search functionality
• Password input
• Options Lists
• Radio and check boxes
Types of forms:
– Search form, Order form, Newsletter sign-up form,
Survey form, Add to Cart form, Login form, and so
on…
<input> <option>
<textarea> <optgroup>
<button> <fieldset>
<select>
<label>
1 Introducing
Tables 2 Styling Tables
3 Introducing
Forms 4 Form Control
Elements
7 8
Summary
Form Controls:
<input>
The input element of a form allows various
kinds of data to be accepted from the
user.
Include one of the following type
attributes:
• text • radio
• password • checkbox
• hidden • submit
• textarea • reset
• Search
• Email
• Tel
• url
25
Randy Connolly and Ricardo Fundamentals of Web
type="text"
• Like with radio buttons, the checked attribute can be used to set
the default value of a checkbox
38
Randy Connolly and Ricardo Fundamentals of Web
Chapter 5
1 Introducing
Tables 2 Styling Tables
3 Introducing
Forms 4 Form Control
Elements
7 8
Summary
Accessible
Forms
Recall the <fieldset>, <legend>, and <label> elements.
Each <label> element should be associated with a single input
element.
<p>Client Type:
<label> <input type="radio" name="type" value="School">School</label>
<label><input type="radio" name="type" value="College">College</label>
<label><input type="radio" name="type" value="University">University</label>
</p>
<label>
<input type="radio" name= "crust" value= "hand"> Hand Tossed
</label>
Or
<label for="email" >Email: </label>
<input type="text" name="CustEmail" id= "email">
42
Randy Connolly and Ricardo Fundamentals of Web
Fieldset and Legend
Elements
The Fieldset Element
– Container tag
– Creates a visual group of form elements on
a web page
The Legend Element
– Container tag
– Creates a text label within the fieldset
<fieldset><legend>Customer
Information</legend>
<label>Name:
<input type="text" name=“name"
id="Name"></label>
<br><br>
<label>Email:
<input type="text" name="Email"
id="Email"></label>
</fieldset> 43
Randy Connolly and Ricardo Fundamentals of Web
Putting It All
Together
One form element containing the desired
controls:
Type Description
<input type="submit"> Creates a button that submits the form data to the server. May
have a value = " " attribute to control the text that displays on
the button.
<input type="reset"> Creates a button that clears any of the user’s already entered
form data. May have a value = " " attribute to control the text
that displays on the button.
<input type="button"> Creates a custom button. This button may require Javascript for
it to actually perform any action.
<input type="image"> Creates a custom submit button that uses an image for its
display.
<input type="file">
time Creates a time input control. The format for the time is
"HH:MM:SS", for hours:minutes:seconds.
datetime Creates a control in which the user can enter a date and time.
datetime Creates a control in which the user can enter a date and time
- local without specifying a time zone.
<label for="address">Address:</label>
<input type="text" name="address" id="address"><br>
<label for="city">City:</label>
<input type="text" name="city" id="city"><br>
<label for="state">State:</label>
<input type="text" name="state" id="state"><br>
1 Introducing
Tables 2 Styling Tables
3 Introducing
Forms 4 Form Control
Elements
7 8
Summary
Microformats
A microformat is a small pattern of HTML markup and attributes to
represent common blocks of information such as people, events,
and news stories so that the information in them can be extracted
and indexed by software agents
hCard – markup contact information
hNews – richly formatted, standardized markup: