Welcome!

I’m Shawn Allen

Former Interaction Director at Stamen
Web design & data visualization geek

What is The Web?

“a series of tubes” ...kinda

The Web is a
network of networks.

Computers on a network act as clients, servers, or both:

  • Software on your computer acts a client
    when you browse the web.
  • Web servers are applications that listen for requests
    and send web pages back.

DNS

Domain Name System

DNS is how computers find one another
within and across networks.

...kind of like an address book.

HTTP

HyperText Transfer Protocol

HTTP is the language spoken by web clients and servers to
send and receive web pages, images, and other assets.

URL

Uniform Resource Locator

Every page (or “resource”) on the Web has its own URL.
URLs can reference resources in several ways:

form description examples
http://domain
http://domain/path
fully-qualified URL http://grayarea.org
http://grayarea.org/events/
/path/to/file absolute path /about.html
path/to/file
../path/to/file
relative path widgets/page1.html
../widgets/page1.html
URL#id fragment identifier #section1
URL?query query string https://google.com/search?q=foo

Web Standards

Web standards are detailed specifications defined by
a group called the W3C (Worldwide Web Consortium).

Standards change and evolve over time, often
in response to the needs of the web design community.

Web Browser

A Web browser is software that speaks HTTP
and understands HTML, CSS and JavaScript.

  • Google Chrome is a very popular browser with great standards support.
  • Apple Safari comes with Mac OS X and runs on iOS devices.
  • Firefox is a popular open-source browser with good standards support.
  • Microsoft Internet Explorer comes with Windows, and until recently was not considered a standards-friendly browser.

HTML

HyperText Markup Language

HTML is the text language of Web documents,
which are made up of structured elements, or tags.

HTML Syntax

Elements generally take the form:

<name attr="value">content</name>
  1. <name opens the element
  2. any number of attributes: attr="value"
  3. > closes the opening tag
  4. text content and/or child elements
  5. </name> closes the element

Empty Elements

Some elements are called “empty” because they have no content. These elements are written without a close tag:


<img src="lion.jpg" alt="This is a photo of a lion.">
            

Nesting Elements

Nesting is a term that we use to describe putting
elements inside one another to define structure:


<parent>
  <child foo="bar"></child>
</parent>

For instance, an HTML document with just a title looks like:


<html>
  <head>
    <title>Hello, world!</title>
  </head>
</html>

Nested elements are said to have a parent-child relationship.
Here, <head> is a child of <html> and the parent of the <title> element.

Document Type Definition

The Document Type Definition, or doctype,
is the first line of your HTML document:

<!DOCTYPE html>

This tells the web browser what type of HTML to expect.
In this case we’re telling it to expect HTML5,
the latest and greatest HTML standard.

<html>

After the doctype goes the <html> element:


<!DOCTYPE html>
<html>
</html>
            

You may add a lang attribute to indicate the (human) language in which the document’s text was written:


<!DOCTYPE html>
<html lang="es">
  <p>¡Que gato gordo!</p>
</html>
            

<head>

The <head>, which includes the document’s title and
other metadata, is generally invisible to the user:


<head>
  <title>My Site Name</title>
  <meta charset="utf-8">
</head>

The <meta charset="utf-8"> element tells the
browser to interpret the document as unicode text.

<body>

And then there’s <body>, which contains all of
the page’s content: text and media, navigation,
links, and anything visible to the viewer*:


<body>
  <h1>My Page Heading</h1>
  <p>This is paragraph of text.</p>
  <img src="lion.jpg" alt="This is photo of a lion.">
</body>

* (or legible to the screen reader)

Document Anatomy

The <head> and <body> are children of the <html> element:


<!DOCTYPE html>
<html>
  <head>
    <title>My Site Name</title>
  </head>
  <body>
    <h1>My Page Heading</h1>
    <p>This is paragraph of text.</p>
    <img src="lion.jpg" alt="This is photo of a lion.">
  </body>
</html>

Structural Elements

HTML5 defines structural elements
to delineate different parts of a document:

<nav> site or page navigation
<header>, <footer> document header and footer
<section> document section
<main> “main” document content
<article> a news article or blog post
<h1-h6> document or section heading
<ol>, <ul>, <li> ordered and unordered lists

Text Elements

<p> a paragraph of text
<div> generic block-level container
<span> generic span of inline text
<b>, <strong>,
<i>, <em>
bold / strong
italic / emphasized inline text
<blockquote>, <q> block-level and inline quotations
<table>, <tr>,
<th>, <td>
data tables
<sub>, <sup> subscript and superscript

Media Elements

HTML5 provides the following elements to embed
images, video, audio and other non-text content:

<img> static images and photos
<svg> Scalable Vector Graphics
<audio> audio
<video> video
<canvas> dynamic 2D and 3D bitmaps
<object>, <embed> third-party plugins (Flash, etc.)

The class Attribute

The class attribute can be added to any element,
and it serves as a way to classify elements, usually
for the purpose of either adding semantics
and/or styling with CSS.


<ol class="cars">
  <li>Honda</li>
  <li class="fancy">Ferrari</li>
  <li class="fancy expensive">Maserati</li>
</ol>
<ol class="people">
  <li class="androgynous">Andy</li>
  <li class="male">Bobby</li>
  <li class="female">Connie</li>
</ol>
            

The id Attribute

The id attribute is used to give elements a
unique identifier, for the purpose of either linking
within the document and/or styling with CSS.


<ol class="cars">
  <li id="honda">Honda</li>
  ...
</ol>
<ol class="people">
  <li id="andy">Andy</li>
  ...
</ol>
            
The spec says: The value must be unique [...] and must contain at least one character. The value must not contain any space characters.

Fragment Identifiers

You can create links within your document by
adding an id attribute to any element, then using
the fragment identifier URL form:


<p>Read more about <a href="#lion">the lion</a>!</p>

<h2 id="lion">The Lion</h2>
            

Semantic Markup

Using meaningful elements, classes and ids
will make it easier to maintain your documents.

  • DO use elements with meaningful names, such as <section> for sections, and <ol> for ordered lists.
  • DO use descriptive class and id attributes for elements that have no semantic HTML equivalent.
  • AVOID using class attributes that describe appearance, such as class="red".

Block-level Elements

e.g. <section>, <div>, <article>, <h1>, etc.

  • have blank lines before and after them
  • take up the width of their parent or “container”
  • can contain text and other block-level or inline elements
  • are generally better suited for defining structure and layout

Inline Elements

e.g. <b>, <em>, <a>, <span>, etc.

  • assume the width of their content
  • can contain text and other inline elements
  • are generally better suited for character-level formatting

HTML Is Forgiving

In theory, many of the elements in an
HTML document are optional:


<!DOCTYPE html>
<p>This is a valid HTML document.
<p>Paragraph close tags are implied.
<ul>
  <li>So are list item close tags.
</ul>
            

But don‘t leave them off just because you can!
The more explicit you are, the easier to edit and
more future-proof your document becomes.

CSS

Cascading Style Sheets

They give HTML style.

(We’ll cover this on Thursday.)

JavaScript

The Web’s programming language

Provides interactivity, animation,
and other dynamic behaviors.

(We’ll cover this in the JavaScript course.)

GitHub

GitHub is a web site and hosted
version control system called git.

Sign up now at:

https://github.com

What Is Git?

Git is the open-source version control system on which GitHub runs. It was created to help programmers maintain the source code of the Linux operating system.

Many people run git from the UNIX command line, but we’ll be using the GitHub native app for Mac or Windows:

Git Workflow

Git provides a workflow that’s suited for distributed, asynchronous development by multiple people.

It deals in changes to one or more files called commits.

  1. Pull commits from a repository.
  2. Make changes.
  3. Commit your changes locally.
  4. Push your commits to another repository.
  5. Repeat ∞

Git can be tricky sometimes, but just remember:
as long as you commit, nothing is lost!

Text Editors

You’re going to need a good text editor to edit HTML, CSS, and JavaScript. In this class we’re going to use:

  1. Atom, which runs on your computer; and
  2. Prose, which runs in your web browser

Atom

Atom is a text editor by the creators of GitHub.
It’s free and open source. Download it now at:

http://atom.io

Note: Atom can be used to edit
any text file on your computer,
independent of GitHub.

Prose

Prose is a web-based text editor that can
be used to edit any text file on GitHub.

http://prose.io

Note: You may edit text files on GitHub,
but Prose offers a nicer experience.

Let’s make a website!

  1. Go to https://github.com
  2. Create your repository: username.github.io
    • Keep it public if you have a free account
    • check “Initialize this repository with a README”
  3. Create index.html and commit your changes
  4. (wait 10 minutes)
  5. Go to http://username.github.io

Example HTML


<!DOCTYPE html>
<html>
  <head>
    <title>Page Title</title>
  </head>
  <body>
    <h1>Page Title</h1>
    <section id="section1">
      <h2>Sub Heading</h2>
      <p>A paragraph of text.</p>
      <h2>Links</h2>
      <ul id="links">
        <li><a href="http://grayarea.org">Gray Area</a></li>
      </ul>
    </section>
  </body>
</html>