Except where otherwise noted, the contents of this presentation are © Copyright 2007 Marty Stepp and are licensed under the Creative Commons Attribution 2.5 License.
<
element>
content </
element>
<p>This is a paragraph</p>
<
element attribute="
value"
attribute="
value">
content </
element>
<a href="page2.html">Next page</a>
<
element attribute="
value"
attribute="
value" />
<img src="bunny.jpg" alt="A bunny" />
<hr />
<html> <head> information about the page </head> <body> page contents </body> </html>
.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> information about the page </head> <body> page contents </body> </html>
<title>
describes the title of the web page
<title>CSE 190 M: HTML</title>
head
of the page<p>
paragraphs of text (block-level)
<p>You're not your job. You're not how much money you have in the bank. You're not the car you drive. You're not the contents of your wallet. You're not your khakis. You're the all-singing, all-dancing crap of the world.</p>
You're not your job. You're not how much money you have in the bank. You're not the car you drive. You're not the contents of your wallet. You're not your khakis. You're the all-singing, all-dancing crap of the world.
<h1>
,
<h2>
, ...,
<h6>
headings to separate major areas of the page (block-level)
<h1>University of Whoville</h1> <h2>Department of Computer Science</h2> <h3>Sponsored by Micro$oft</h3>
<a>
anchors denote links to other pages (inline)
<p>Search <a href="http://www.google.com/">Google</a> now!</p>
Search Google now!
href
attribute to specify the destination URLp
or h1
<p><a href="1-internet.html">Lecture Notes 1</a></p> <p><a href="http://www.google.com/" title="Search">Google</a></p>
title
attributeBad:
<p><a href="1-internet.html">Lecture Notes 1</p> <p>This text also links to Lecture Notes 1</a></p>
<br>
forces a line break in the middle of a block-level element (inline)
<p>Teddy said it was a hat,<br />So I put it on.</p> <p>Now Daddy's sayin',<br /> Where the heck's the toilet plunger gone?</p>
Teddy said it was a hat,
So I put it on.
Now Daddy's sayin',
Where the heck's the toilet plunger gone?
br
should be immediately closed with />
br
should not be used to separate paragraphs or used multiple times in a row to create spacing<hr>
a horizontal line to visually separate sections of a page (block-level)
<p>First paragraph</p> <hr /> <p>Second paragraph</p> <hr />
First paragraph
Second paragraph
/>
<img>
inserts a graphical image into the page (inline)
<p><img src="gollum.jpg" alt="Gollum from LOTR" /></p>
src
attribute specifies the image URLalt
attribute describing the image<p><a href="http://theonering.net/"> <img src="gandalf.jpg" alt="Gandalf from LOTR" title="You shall not pass!" /></a></p>
a
anchor, the image will become a linktitle
attribute specifies an optional tooltip<!--
... -->
comments to document your HTML file or "comment out" text
<!-- My web page, by Suzy Student CSE 190 D, Spring 2007 --> <p>CSE courses are <!-- NOT --> a lot of fun!</p>
CSE courses are a lot of fun!
<ul>
, <li>
ul
represents a bulleted list of items (block-level)
li
represents a single item within the list (block-level)
<ul> <li>No shoes</li> <li>No shirt</li> <li>No problem!</li> </ul>
<ul> <li>Simpsons: <ul> <li>Bart</li> <li>Lisa</li> </ul> </li> <li>Family Guy: <ul> <li>Peter</li> <li>Lois</li> </ul> </li> </ul>
<ol>
ol
represents a numbered list of items (block-level)
<p>RIAA business model:</p> <ol> <li>Sell music on easily copyable discs</li> <li>Sue customers for copying music</li> <li>???</li><li>Profit!</li></ol>
RIAA business model:
<ul>
<li>No shoes</li>
<li>No shirt</li>
<li>No problem!</li>
<p>Paragraph after list...</p>
Paragraph after list...
<ul> <li>Simpsons:</li> <ul> <li>Bart</li> <li>Lisa</li> </ul> </li> <li>Family Guy: <ul> <li>Peter</li> <li>Lois</li> </ul> </ul>
li
too early (or not at all) will render correctly in most browsers, but it is incorrect XHTML<dl>
, <dt>
, <dd>
dl
represents a list of definitions of terms (block-level)
dt
represents each term, and dd
its definition
<dl> <dt>newbie</dt><dd>one who does not have mad skills</dd> <dt>own</dt><dd>to soundly defeat (e.g. "I owned that newbie!")</dd> <dt>frag</dt><dd>a kill in a shooting game</dd> </dl>
<blockquote>
a lengthy quotation (block-level)
<p>As Lincoln said in his famous Gettysburg Address,</p> <blockquote> <p>Fourscore and seven years ago, our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal. </p></blockquote>
As Abraham Lincoln said in his famous Gettysburg Address,
Fourscore and seven years ago, our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.
<q>
a short quotation (inline)
<p>Quoth the Raven, <q>Nevermore.</q></p>
Quoth the Raven, Nevermore.
<p>Quoth the Raven, "Nevermore."</p>
We don't use " marks for two reasons:
"
<em>
, <strong>
, <code>
em
: emphasized text (usually rendered in italic)
strong
: strongly emphasized text (usually rendered in bold)
code
: a short section of computer code (usually rendered in a fixed-width font)
<p>The <code>ul</code> and <code>ol</code> tags make lists.</p> <p>HTML is <em>really</em>, <strong>REALLY</strong> fun!</p>
The ul
and ol
tags make lists.
HTML is really, REALLY fun!
<pre>
a large block of code text in a fixed-width font (block-level)
<pre> public static void main(String[] args) { System.out.println("Hello, world!"); } </pre>
public static void main(String[] args) { System.out.println("Hello, world!"); }
pre
blocks are displayed with exactly the whitespace and line breaks given in the documentcode
tags?Interaction Pane: | |
---|---|
KITTENS!Why I love them:
|
|
<p><a href="http://validator.w3.org/check/referer"> <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Validate" /></a></p>
hobbitten.html
.<meta>
information about your page (for a browser, search engine, etc.)
<meta name="description" content="Authors' web site for Building Java Programs." /> <meta name="keywords" content="java, textbook" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
head
of your HTML pagemeta
tags often have both the name
and content
attributes
meta
tags use the http-equiv
attribute instead of name
meta
element to describe the page<head> <meta name="author" content="web page's author" /> <meta name="revised" content="web page version and/or last modification date" /> <meta name="generator" content="the software used to create the page" /> </head>
meta
generator
tag (why?)meta
element to aid search engines<head> <meta name="description" content="how you want search engines to display your page" /> <meta name="keywords" content="words to associate with your page (comma-separated)" /> </head>
meta
element to aid browser / web server<meta http-equiv="refresh" content="how often to refresh the page (seconds)" /> </head> <meta http-equiv="Content-Type" content="what type of document this is (may include internationalization information such as character encoding)" />
meta
Content-Type
tag gets rid of the W3C "tentatively valid" warning<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
meta
refresh
tag can also redirect from one page to another:<meta http-equiv="refresh" content="5;url=http://www.bjp.com" />
<link rel="shortcut icon" type="MIME type" href="filename" />
<link rel="shortcut icon" type="image/gif" href="cse.gif" />
link
tag, placed in the HTML page's head
section, can specify an icon for a web page
.ico
format named favicon.ico
in the root directory of the web server (instructions)classifications of data that travel over the internet
MIME type | file extension |
---|---|
text/html | .html |
text/plain | .txt |
image/gif | .gif |
image/jpeg | .jpg |
video/quicktime | .mov |
application/octet-stream | .exe |
a way of representing any Unicode character within a web page
character(s) | entity |
---|---|
< > | < > |
é è ñ | é è ñ |
™ © | ™ © |
π δ Δ | π δ Δ |
И | И |
" & | " & |
&
on a web page?<p><a href= "http://www.google.com/search?q=marty+stepp&ie=utf-8&aq=t"> Search Google for Marty</a></p>
<p><a href= "http://www.google.com/search?q=marty+stepp&ie=utf-8&aq=t"> Search Google for Marty</a></p>