Tables, Forms, and CSS




CS174

Chris Pollett

Sep 12, 2016

Outline

Introduction to Tables

Today, we continue our discussion of HTML and XHTML 5 by looking at the table and form tags.

Example:

<style>
table, th, td {
  border: 1px solid black;
}
</style>
<table>
    <caption>grade table</caption>
    <tr><th></th><th>Item</th><th>Value</th></tr>
    <tr><th>1.</th><td>Homeworks</td><td>50%</td></tr>
    <tr><th>2.</th><td>Exams</td><td>50%</td></tr>
</table>
grade table
ItemValue
1.Homeworks50%
2.Exams50%

More on Tables

You can make table headings or table data span more than one column or more than one row using colspan, rowspan:

<tr><th colspan="3">heading</th></tr>

Here is an example where we have two levels of heads at the top of a table:

<tr><th colspan="2">heading</th></tr>
<tr><th>subhead1</th><th>subhead2</th></tr>
<tr><td>1</td><td>2</td></tr>

An Accessibility Interlude

Tables and Accessibility

Controlling width

Still More on Tables

Cellpadding, cellspacing

Quiz (Sec 2)

Which of the following statements is true?

  1. The following is an example of the syntax for an HTML comment:
    <? hi there ?>
    
  2. The following code fragment could be part of a legal HTML 5 document:
    <ul>
    <h1>hi there</h1>
    <li>A list item.</li>
    </ul>
    
  3. In a valid HTML 5 document, the HTML head tag must contain a title tag.

Quiz (Sec 3)

Which of the following statements is true?

  1. There is no syntax for writing comments in HTML
  2. The title tag is allowed to appear within the body tag of a document.
  3. To make an unordered list in HTML 5 we can use the ul and li tags.

Forms

Possible methods

Labels and Controls

select tags

<textarea>

Stylesheets