Markup And Semantics

Kevin Lawver

This is a presentation. If you'd like to view all the slides like a normal web page, you can.

Introduction

What's In A DOCTYPE?

DOCTYPE Switching

Standards Mode vs. Quirks Mode

Why XHTML?

The Basics of XHTML

Rules for XHTML

Why Not XHTML 1.0 Strict?

Why Not application/xml+html?

Example: Bare XHTML Document

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Bare</title>
</head>
<body>

</body>
</html>

Block Elements

Inline Elements

Semantics

Things That Have No Meaning

What's A Div?

What's a Span?

Lists

Example: Unordered List

The Source: Unordered List

<ul>
   <li>Apples</li>
   <li>Oranges</li>
   <li>Lemons</li>
   <li>Grapes</li>
</ul>

Example: Definition List


Semantics

The study or science of meaning in language.

The study of relationships between signs and symbols and what they represent.
Also called semasiology.

The meaning or the interpretation of a word, sentence, or other
language form: We're basically agreed; let's not quibble over semantics.

The Source: Definition List

<dl>
  <dt>Semantics<dt>
  <dd>The study or science of meaning in language.</dd>
  <dd>The study of relationships between signs and symbols and what they represent. 
  Also called semasiology.</dd>
  <dd>The meaning or the interpretation of a word, sentence, or other
  language form: We're basically agreed; let's not quibble over semantics.</dd>
</dl>

Tables

Example: Tables

Table of products and prices.
ProductPrice
Apples$.50
Orange$.30
Lemon$.25
Grape$.01

The Source: Table

<table summary="first column is product name, second column is product price.">
  <caption>Table of products and prices.</caption>
  <tr>
    <th>Product</th><th>Price</th>
  </tr>
  <tr>
    <td>Apples</td><td>$.50</td>
  </tr>
  <tr>
    <td>Orange</td><td>$.30</td>
  </tr>
  <tr>
    <td>Lemon</td><td>$.25</td>
  </tr>
  <tr>
    <td>Grape</td><td>$.01</td>
  </tr>
</table>

Forms

Example: Form


Personal Information:

Eye Color:

The Source: Form

<form action="/search" method="GET">
  <fieldset>
    <legend>Personal Information</legend>
    <label for="name_field">Name:</label> <input type="text" name="name" id="name_field"/>
    <label for="address_field">Address:</label> <input type="text" name="address" id="address_field"/>
    <fieldset>
      <legend>Eye Color:</legend>
      <input type="radio" name="eye_color" value="blue" id="blue_field"/> <label for="blue_field">blue</label>
      <input type="radio" name="eye_color" value="brown" id="brown_field"/> <label for="brown_field">brown</label>
      <input type="radio" name="eye_color" value="green" id="green_field"/> <label for="green_field">green</label>
    </fieldset>
  </fieldset>
  <input type="submit" value="Submit" title="Click to submit your information"/>
</form>

Page Divisions

Example: Div

i am the content.

The Source: Div

<div id="head">i am the head.</div>
<div id="menu">i am the menu.</div>
<div id="content">i am the content.</div>
<div id="foot">i am the foot</div>

Validation

Best Practices

What's This Hooks Nonsense?

Hacks

Semantic Examples

Exercise: The Header

What Is It?

Your Pieces

My Source

<div id="head">
    <h1>AOL</h1>
    <form action="/search" method="GET">
        <fieldset>
            <input type="text" name="query" class="searchbox" title="enter search terms and hit Enter"/>
            <input type="submit" value="search" class="button"/>
        </fieldset>
    </form>
    <ul id="nav">
        <li><a href="#">Main</a></li>
        <li><a href="#">News</a></li>
        <li><a href="#">Entertainment</a></li>
        <li><a href="#">Personal Finance</a></li>
        <li><a href="#">Local</a></li>
        <li><a href="#">Games</a></li>
    </ul>
</div>

The Method To The Madness

How Do I?

Q&A

category: Presentations, Markup