Introductions
Course Overview
Syllabus
The Internet
HTML
The Internet
How the Internet works
How to make web pages
How web pages work
Client-server relationship
Web pages are content, styling, and behavior
Making web pages is fun!
I won't know the answers to lots of questions, and I will google things in front of you.
I will fix my terrible code in front of you.
Content: Hypertext Markup Language (HTML): used for writing web pages
Style: Cascading Style Sheets (CSS): stylistic info for web pages
Behavior: JavaScript: interactive and programmable web pages
Data representation for transfer: Javascript Object Notation (JSON)
Enhanced data transfer: Asynchronous JavaScript and XML (AJAX)
Dynamic Web Servers: PHP Hypertext Processor (PHP)
Data Bases: Structured Query Language (SQL)
Wikipedia: http://en.wikipedia.org/wiki/internet
A connection of computer networks using the Internet Protocol (IP)
Began as a US Department of Defense network called ARPANET (1960s-70s)
Initial services: electronic mail, file transfer
Opened to commercial interests in late 80s
WWW created in 1989-91 by Tim Berners-Lee
Popular web browsers released: Netscape 1994, IE 1995
Amazon.com opens in 1995; Google in January 1996
Hamster Dance web page created in 1999
Facebook founded in February 2004
Snapchat created in September 2011
Subnetworks can stand on their own
Computers can dynamically join and leave the network
Built on open standards; anyone can create a new internet device
Lack of centralized control (mostly)
Everyone can use it with simple, commonly-available software
Who "runs" the Internet? Who is responsible for overseeing it?
Internet Engineering Task Force (IETF): Internet protocol standards
Internet Corporation for Assigned Names and Numbers (ICANN): decides top-level domain names
World Wide Web Consortium (W3C): web standards
These protocols are carried out in large part by Internet service providers and other companies and organizations who build Internet-related products and applications
Physical layer: devices such as ethernet, coaxial cables, fiber-optic lines, modems
Data Link Layer: basic hardware protocols (ethernet, wifi, DSL PPP)
Network/Internet Layer: basic software protocol (IP)
Transport Layer: adds reliability to network layer (TCP, UDP)
Application Layer: implements specific communications for each kind of program (HTTP, POP3/IMAP, SSH, FTP)
A simple protocol for attempting to send data between two computers
Each device has a 32-bit IP address written as four 8-bit numbers (0-255)
Find your internet IP address: whatismyip.com
Find out your local IP address: in a terminal, type ipconfig
(Windows) or ifconfig
(Mac/Linux)
Adds multiplexing, guaranteed message delivery on top of IP
Multiplexing: multiple programs using the same IP address
Some programs (games, streaming media programs) use simpler UDP protocol instead of TCP
The Internet describes all the interconnected devices that use the "internet protocol." The World Wide Web is the subset of the Internet that uses the HTTP and HTTPS protocols, mostly to transmit "webpages."
Web server: software that listens for web page requests
Web browser: fetches/displays documents from web servers
An identifier for the location of a document on a web site
A basic URL:
http://www.aw-bc.com/info/regesstepp/index.html
~~~~ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
protocol host path
Upon entering this URL into the browser, it would:
www.aw-bc.com
GET /info/regesstep/index.html
A set of servers that map written names to IP addresses
www.cs.washington.edu → 128.208.3.88
Many systems maintain a local cache called a hosts file
C:\Windows\system32\drivers\etc\hosts
/private/etc/hosts
/etc/hosts
The set of commands understood by a web server and sent from a browser
Some HTTP commands (your browser sends these internally):
GET filename
: downloadPOST filename
: send a web form responsePUT filename
: upload
Simulating a browser with a terminal window:
When something goes wrong, the web server returns a special "error code" number to the browser, possibly followed by an HTML document
Common Error Codes:
Number | Meaning |
---|---|
200 | OK |
301-303 | page has moved (permanently or temporarily) |
403 | you are forbidden to access this page |
404 | page not found |
418 | I'm a teapot |
500 | internal server error |
Sometimes when including resources in a page (style sheet, icon, multimedia object), we specify their type of data
MIME type | file extension |
---|---|
text/html | .html |
text/plain | .txt |
image/gif | .gif |
image/jpeg | .jpg |
video/quicktime | .mov |
application/octet-stream | .exe |
Lists of MIME types: by type, by extension
Content and Structure: HTML
Style: CSS
Behavior: JavaScript
Describes the content and structure of information on a web page
Surrounds text content with opening and closing tags
Each tag's name is called an element
<element> content </element>
<p>This is a paragraph</p>
Most whitespace is insignificant in HTML (ignored or collapsed to a single space)
We will use a newer version called HTML5
<!DOCTYPE html>
<html>
<head>
information about the page
</head>
<body>
page contents
</body>
</html>
The <head>
tag describes the page and the <body>
tag
contains the page's content
An HTML page is saved into a file ending with extension .html
The DOCTYPE
tag tells the browser to interpret our page's code as
HTML5, the lastest/greatest version of the language
<title>
Chapter 2: HTML Basics
Placed within the <head>
of the page
Displayed in the web browser's title bar and when bookmarking the page, otherwise not visible to the user as page content
<p>
paragraphs of text (block)
You're not your job.
You're not how much money you make in the bank.
You're not the car you drive.
You're not the content of your wallet.
You're not your khakis.
You're not the all-singing, all-dancing crap of the world.
You're not your job. You're not how much money you make in the bank. You're not the car you drive. You're not the content of your wallet. You're not your khakis. You're not the all-singing, all-dancing crap of the world.
Placed in the body
of the page
<h1>
,
<h2>
, ...,
<h6>
headings to separate major areas of the page (block)
University of Whoville
Department of Computer Science
Sponsored by Micro$oft
<header>
and <footer>
<header>
tags usually contain one or more <h1-6>
elements, maybe a logo, and authorship information
<footer>
tags might contain site map links, authorship
information, copyright information, etc.
more html elements
...maybe some other stuff...
These tags are both block elements
Note: not to be confused with the <head>
tag, the
<header>
is designed to contain headings for a
document.
<article>
and
<section>
The <article>
tag is a standalone piece of content (eg, entire blog post, including title, author, etc) (block)
The <section>
tag is a piece of content that doesn't make sense on it's own (a chapter, paragraph, etc) (block)
Whitaker's resume:
<section>
Objective:
...
</section>
<section>
Experience:
...
</section>
<section>
References:
...
</section>
<hr>
a horizontal line to visually separate sections of a page (block)
First paragraph
<hr />
Second paragraph
<hr>
Third paragraph
First paragraph
Second paragraph
Third paragraph
This is the first example we've seen of a void (self-closing
) tag:
more on HTML Element types
<a>
links, or "anchors", to other pages (inline)
Search for it on Google!
Search for it on Google!
Uses the href
attribute to specify the destination URL
Anchors are inline elements; must be placed in a block element such as
<p>
or <h1>
Some tags can contain additional information called attributes
<element
attribute="value"
attribute="value">
content </element>
<a href="page2.html">Next page</a>
Some tags don't contain content and can be opened and closed in one tag
<element attribute="value" attribute="value" />
<br />, <hr />, <br>, <hr>
<img src="bunny.jpg" alt="pic from Easter" />
Block elements contain an entire large region of content
Inline elements affect a small amount of content
Block vs. inline:
<body>
, <form>
<p>
tags can contain only inline elements and plain text
<div>, <li>
Some elements are only allowed to contain certain other elements:
<ul>
is only allowed to contain <li>
Some elements are only allowed once per document:
<html>
<body>
<head>
<main>
<img>
Inserts a graphical image into the page (inline)
The src
attribute specifies the image URL
HTML5 also requires an alt
attribute describing the image, which
improves
accessibility for users who can't otherwise see it
<a href="http://en.wikipedia.org/wiki/Koala/">
<img src="images/irrelephant.jpg" alt="Irrelephant elephant"
title="dumbo!" />
</a>
If placed in an <a>
anchor tag, the image becomes a link
What's the title attribute?
title
attribute is an optional tooltip (on ANY element)title
attribute doesn't always work well for mobile and
accessibility, so its usage and future are debated<br />
forces a line break in the middle of a block element (inline)
The woods are lovely, dark and deep,
But I have promises to keep,
And miles
to go before I sleep,
And miles to go before
I sleep.
The woods are lovely, dark and deep,
But I have promises to keep,
And miles
to go before I sleep,
And miles to go before
Warning: Don't over-use br
(guideline: >= 2 in a row is bad, better to not use any)
br
tags should not be used to separate paragraphs or used multiple times in a row to create spacing
<em>
, <strong>
em
: emphasized text (usually rendered in italic)
strong
: strongly emphasized text (usually rendered in bold)
HTML is really, REALLY fun!
HTML is really, REALLY fun!
As usual, the tags must be properly nested for a valid page
<p>
HTML is <em>really,
<strong>REALLY</em> lots of</strong> fun!
</p>
<p>
HTML is <em>really</em>,
<strong>REALLY</strong> lots of</strong> fun!
</p>
Tags must be correctly nested
The browser may render it correctly anyway, but it is invalid HTML
<!--
...
-->
comments to document your HTML file or "comment out" text
<!-- My web page, by Suzy Student
CSE 190 D, Spring 2048 -->
<p>CSE courses are <!-- NOT --> a lot of fun!</p>
CSE courses are a lot of fun!
Many web pages are not thoroughly commented (or at all)
Still useful at top of page and for disabling code
Comments cannot be nested and cannot contain a --
It is important to write proper HTML code and follow proper syntax
Why use valid HTML and web standards?
Checks your HTML code to make sure it follows the official HTML syntax
More picky than the browser, which may render bad HTML correctly
<ul>
,
<li>
ul
represents a bulleted list of items (block)
li
represents a single item within the list (block)
- No shoes
- No shirt
- No problem
A list can contain other lists:
- Simpsons:
- Homer
- Marge
- Family Guy:
- Peter
- Lois
<ol>
ol
represents a numbered list of items (block)
RIAA business model:
<ol>
Sue customers
???
Profit!
</ol>
</p>
RIAA business model:
We can make lists with letters or Roman numerals using CSS (later)
<dl>
, <dt>
, <dd>
dl
represents a list of definitions of terms (block)
dt
represents each term, and dd
its definition
- newbie
-
one who does not have
mad skills
- own
-
to soundly defeat (e.g.
I owned that newbie!)
- frag
-
a kill in a shooting game
<blockquote>
a quotation (block)
As 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.
As 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)
Quoth the Raven, Nevermore.
Why not just write the following?
<p>Quoth the Raven, "Nevermore."</p>
We don't use " marks for two reasons:
"
<q>
allows us to apply CSS styles to quotations (seen later)a way of representing any Unicode character within a web page
character(s) | entity |
---|---|
< > | < > |
é è ñ | é è ñ |
™ © | ™ © |
π δ Δ | π δ Δ |
И | И |
" & | " & |
&
on a web page?<p>
<a href="http://google.com/search?q=marty&ie=utf-8">
Search Google for Marty
</a>
</p>
<p> <a href="http://google.com/search?q=marty&ie=utf-8"> Search Google for Marty </a> </p>
To display the link text in a web page, its special characters must be encoded as shown above
<del>
, <ins>
content that should be considered deleted or added to the document (inline)
Final Exam Midterm is on Aug 29
Apr 17.
Final Exam Midterm is on Aug 29
Apr 17.
<abbr>
an abbreviation, acronym, or slang term (inline)
Safe divers always remember to check their
SCUBA gear.
Safe divers always remember to check their SCUBA gear.
<code>
a short section of computer code (usually shown in a fixed-width font)
The ul
and ol
tags make lists.
The ul
and ol
tags make lists.
<pre>
a large section of pre-formatted text (block)
<pre>
Steve Jobs speaks loudly
reality distortion
Apple fans bow down
</pre>
Steve Jobs speaks loudly reality distortion Apple fans bow down
Displayed with exactly the whitespace / line breaks given in the text
Shown in a fixed-width font by default
How would it look if we had instead enclosed it in code
tags?
<meta>
information about your page (for a browser, search engine, etc.)
Placed in the head
section of your HTML
page
meta
tags often have both the name
and content
attributes
meta
tags use the http-equiv
attribute instead of name
meta
tag with charset
attribute indicates language/character encodingsUsing a meta
tag Content-Type
stops validator "tentatively valid" warnings
<link href="filename" type="MIME type" rel="shortcut icon" />
<link href="yahoo.gif" type="image/gif" rel="shortcut icon" />
The link
tag, placed in the head
section, attaches another file to the page
Note for IE6: Doesn't work; must put a file favicon.ico
in the root
of the web server (info)