Hypertext Markup Language (HTML)

Web Architecture (INFO 290-03)

Erik Wilde, UC Berkeley School of Information
2007-10-02
Creative Commons License

This work is licensed under a CC
Attribution 3.0 Unported License

Abstract

The Hypertext Markup Language (HTML) is the most important content type on the Web. Even though it is primarily intended for humans (by presenting formatted pages of textual content), it also has facets that are important for machine-based processing. HTML can be use in a variety of ways, and this lecture looks at some of the important rules that should be observed when creating HTML, for example how to use HTML markup in general and how to create accessible forms.

HTML and WYSIWYG

Layout Engine Usage

Usage share of Layout Engines

Outline (HTML and Structure)

  1. HTML and Structure [2]
  2. HTML Forms [15]
  3. XHTML [3]
  4. Conclusions [1]

All-Purpose Elements

Retain Content Structures

Outline (HTML Forms)

  1. HTML and Structure [2]
  2. HTML Forms [15]
  3. XHTML [3]
  4. Conclusions [1]

HTTP Web Services

Forms Mechanics

form-mechanics.png

Forms Markup

Forms Elements (User View)


Text:
Password:
Checkbox:
Radio Button:
Submit:
File Upload:
Text Areas:
Selection:
Multiple Selection:

Forms Elements (Source View)

<form action="http://stevex.net/dump.php" method="POST" enctype="multipart/form-data"><table>

<tr><td>Text:</td><td><input type="text" name="text" value="text input"/></td></tr>

<tr><td>Password:</td><td><input type="password" name="password" value="hidden text"/></td></tr>

<tr><td>Checkbox:</td><td><input type="checkbox" name="check" value="1"/> <input type="checkbox" name="check" value="2"/> <input type="checkbox" name="check" value="3"/></td></tr>

<tr><td>Radio Button:</td><td><input type="radio" name="radio" value="1"/> <input type="radio" name="radio" value="2"/> <input type="radio" name="radio" value="3"/></td></tr>

<tr><td>Submit:</td><td><input name="submit" type="submit"/></td></tr>

<tr><td>File Upload:</td><td><input name="file" type="file"/></td></tr>

<tr><td>Text Areas:</td><td><textarea name="textarea" rows="2" cols="20"/></td></tr>

<tr><td>Selection:</td><td><select name="select"><option selected="selected">XML</option><option>SGML</option></select></td></tr>

<tr><td>Multiple Selection:</td><td><select name="mselect" multiple="multiple"><option>242</option><option>290-3</option><option>290-13</option></select>

</table></form>

Forms and GET

Forms and POST

POST Form Processing

Processing of Form Data

Query Parameter Test:
<?php
import_request_variables("gP", "form_");
echo $form_test;
?> 

Structuring Forms

Labels

<tr><td>Text:</td><td><input type="text" name="text"/></td></tr>
<tr><td>Password:</td><td><input type="password" name="password"/></td></tr>
<tr>
<td><label for="textctrl">Text:</label></td>
<td><input type="text" name="text" id="textctrl"/></td>
</tr>
<tr>
<td><label for="pwdctrl">Password:</label></td>
<td><input type="password" name="password" id="pwdctrl"/></td>
</tr>

Fieldsets

<fieldset><legend>Billing</legend>billing form controls …</fieldset>
<fieldset><legend>Shipping</legend> shipping form controls … </fieldset>
Billingbilling form controls …
Shippingshipping form controls …

Tabbing in Forms

Disabled and Readonly Controls

Disabled and Readonly Controls Display

Normal Control Disabled Control Readonly Control
Text:
Password:
Checkbox: !
Radio Button: !
File Upload: !
Text Areas:
Selection:[ not supported ]
Multiple Selection:

Outline (XHTML)

  1. HTML and Structure [2]
  2. HTML Forms [15]
  3. XHTML [3]
  4. Conclusions [1]

XHTML and HTML

Relationship of HTML, SGML, XHTML, and XML

Why XHTML?

HTML → XHTML

<P>Paragraphs often are not closed properly.
<IMG WIDTH=200 HEIGHT=300 SRC="test.png">
<P>And images by definition are always empty elements.
<p>Paragraphs often are not closed properly.</p>
<img width="200" height="300" src="test.png" />
<p>And images by definition are always empty elements.</p>

Outline (Conclusions)

  1. HTML and Structure [2]
  2. HTML Forms [15]
  3. XHTML [3]
  4. Conclusions [1]

HTML Matters