XHTML and HTML 5




CS174

Chris Pollett

Feb 8, 2016

Outline

Basic Syntax

Last Wednesday, we finished talking about HTTP and started going over this slide on the basic syntax of HTML:

Standard XHTML 1.1 Document Structure

XML declarations:

<?xml version ="1.0" encoding="utf-8" ?>
<!-- as not supported by some old 
   browsers validators doesn't usually check this -->

SGML DOCTYPE. This says which Document Type Definition will be used:

<!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 

The XHTML document:

<html xmlns="http://www.w3.org/1999/xhtml" >
		<!-- might have namespaces for other things like SVG -->
<head>
	<title>name of my document</title></head>
<body><!--actually page stuff--></body>
</html>

Minimal HTML 5 Document

Where to Edit HTML

How to "run" your HTML

What does it mean for your HTML to "work"?

The head of an XHTML or HTML5 document

Let's go back to examining the parts of an HTML document...

Kinds of Meta Information

Head's of documents can also have (but is not required to have) meta tags.

<meta name="author" content="who wrote the page" />
<meta name="generator" content="ChrisTextTool" /> 
   <!--What software was used to generate this html -->
<meta name="description" content="how I would like the search 
   engines to describe my page. " />
<meta name="keywords" content="cool site" /> 
   <!--Key terms search engines should index this site with. 
    Unfortunately, not really used by search engines anymore -->
<meta name="robots" content="comma separated list of 
   what would like crawler to do" /> 
   <!-- Example commands NOINDEX, NOFOLLOW, NOCACHE, NOSNIPPET, NOODP, NOYDIR . 
     Some of these commands can also be specified in a robots.txt file. ROBOTS
     and these values are case insensitive.-->

Rather than use robots in the above you can also give directives for specific robots.

In addition to the above meta tags, we will see later in the semester how aspects of how the screen renders in a mobile phone can be affected by meta tags.

The WHATWG Meta Extensions page contains a relatively complete list of values for the name and content attribute.

More Meta Information

Quiz

Which of the following statements is true?

  1. A Web Server looks under its server root directory to try to find the file requested by the path portion of a url.
  2. text/plain/Notepad is a valid MIME type.
  3. HEAD is one of the kinds of HTTP requests we discussed last week.

The body of a web page

More on Block level elements

Getting Round Objects and Other Effects

More effects

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

<h1></h1> - <h6></h6>
heading tags to give a heading title for a section. These must be properly nested.
  <h1>heading1</h1> 
	<h2>heading 2</h2>
		<h3>heading</h3>
  <!--this is okay -->
<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.