More HTML Body Tags - Tables - Accessibility




CS174

Chris Pollett

Feb 10, 2021

Outline

Introduction

What tags can go into the body of a web page?

<h1></h1> - <h6></h6>
are called heading tags. They are used to give a heading for a section of a web document. To be accessible the numbering of heading tags should be properly nested.
  <h1>heading1</h1> 
	<h2>heading 2</h2>
		<h3>heading</h3>
  <!--this is okay, should not do things like skip from an h2 
  to an h4 tag without an h3 tag in between. Screen readers use 
  these headings to extract a table of contents for the document -->
<p></p>
used to specify a paragraph. By default this is style'd with an indentation.
<div></div>
used to specify a related section of text. This tag is a very generic container tag that doesn't have very much semantic meaning. HTML 5 specifies several other block level container tags with more meaning: <header>, for text that is at the top of the document; <section>, for chapters, etc.; <figure>, for figures included in documents.
<blockquote></blockquote>
used to indent large quotations.
<ul></ul> <ol></ol>
unordered and ordered lists. Elements in list are specified with <li></li>. There are also <dl></dl> definition lists.
  <ul>
    <li>List Item 1</li>
    <li>List Item 2
      <ul>
        <li>Sub List Item</li>
      </ul>       
    </li>
  </ul>
  • List Item 1
  • List Item 2
    • Sub List Item
  <ol>
    <li>List Item 1</li>
    <li>List Item 2
      <ol>
        <li>Sub List Item </li>
      </ol>       
    </li>
  </ol>
  1. List Item 1
  2. List Item 2
    1. Sub List Item
<form></form>
used to make a web form.
<table></table>
used to make a table in a web page.

More HTML tags (Inline tags)

Entities in HTML and XHTML

Introduction to Tables

Example:

Below is an example table we discussed:

<style>
table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}
</style>
<table>
    <caption>grade table</caption>
    <tr><td></td><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%

Note: Although in this example we used the <style> tag immediately before the table, for this to be valid html, all style tags would need to be in the <head> of the document.

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 headings 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>

In-Class Exercise

An Accessibility Interlude