Administrivia
Finish discussing HTML
Discuss Accessible Design
Start CSS
Syllabus
Sections and Labs
Sections and Labs will reinforce learning from lectures
Quick checks in section starting next week
Attend the section you are signed up for!
Cloud 9 update
Local development (example)
Testing quick things using Codepen.io
Things that are relevant
From Wikipedia
Content
Words and images
Structure
HTML
Style
CSS
Behavior
Javascript & Server programs
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>
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
There are many different types of HTML tags used to structure web pages (we can't possibly cover all of them within lecture).
A comprehensive list is here (it's a great bookmark page for reference this quarter!)
Unless otherwise specified, all of the tags listed are required to be in the <body>
of an HTML page rather than the <head>
Our compiled list is here and here
HTML is a subset of Extensible Markup Language (XML) ( more info)
Self closing tags like Horizontal rule
<hr>
can either have the slash in the tag or not, but BE CONSISTENT IN YOUR CODE.
<hr />
<hr>
Tags that start with <!
like is <!DOCTYPE html>
is considered
Markup
Declaration
<!DOCTYPE html>
<html>
<head>
<title>About Me: Nicole Riley</title>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h2>About Me: Nicole Riley</h2>
</div>
<p>Hello, everyone! My name is ......</p>
...
</body>
</html>
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" />
<p>
HTML is <em>really,
<strong>REALLY</em> lots of</strong> fun!
</p>
HTML (bad)
<p>
HTML is <em>really</em>,
<strong>REALLY</strong> lots of</strong> fun!
</p>
HTML (good)
Tags must be correctly nested
The browser may render it correctly anyway, but it is invalid HTML
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>
Everyone has different abilities
Nearly 1 in 5 people have a disability in the U.S. (from the U.S. Census)
Disabilties can be temporary
Disabilties can be situational
Disabilty affects all of us
Designs that account for all abilities are called accessible designs
Enable your phone's screen reader
Input works differently now. For example, tap now reads the screen and double-tap selects. Use two or three fingers to scroll by page. Play with it for a minute.
Try closing your eyes and reading a webpage or a social networking site. Try writing an email.
Medical view
Legal view
Sociocultural view
Design for as many users as possible, not just the average user
Example: Airplane cockpits:
Universal Design is often used in architecture
Instead of focusing on the abilities that someone lacks (dis-ability), and trying to compensate
Focus on making systems work with what abilities people have
Don't make people adapt to the system
Make the system adapt to the abilities of the user
First two are required, other five are recommended
Tools
Resources
Use document structre tags: e.g., <article>
, <strong>
as opposed to deprecated style tags like <b>
Provide metadata: e.g., <html lang="en">
Provide alternatives: e.g., img alt tag, video captions, transcripts, allow both keyboard and mouse input
Avoid directional text: eg. "the diagram on the right shows..."
Note: These design prinicples help in other ways as well
<img>
Inserts a graphical image into the page (inline)

HTML
output
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>
HTML
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
White space usually doesn't matter in HTML pages, except apparently here
Preview of imagelinktext.html
<meta>
information about your page (for a browser, search engine, etc.)
HTML
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
It is important to write proper HTML code and follow proper syntax
Why use valid HTML and web standards?
It is vital that you write readable code. We have Coding Standards
Comments: <!--
...
-->
comments to document your HTML file or "comment out" text
<!-- My web page, by Suzy Student
CSE154 Spring 2048 -->
<p>CSE courses are <!-- NOT --> a lot of fun!</p>
HTML
CSE courses are a lot of fun!
output
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 --
Do not leave commented-out HTML code in your homework assignments!
HTML
Checks your HTML code to make sure it follows the official HTML syntax
More picky than the browser, which may render bad HTML correctly
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=puppies&ie=utf-8">
Search Google for Puppies
</a>
</p>
HTML
<p> <a href="http://google.com/search?q=puppies&ie=utf-8"> Search Google for Puppies </a> </p>
output
To display the link text in a web page, its special characters must be encoded as shown above
Content
Words and images
Structure
HTML
Style
CSS
Behavior
Javascript & Server programs
<p>
<font face="Arial">Welcome to Greasy Joe's.</font>
You will <b>never</b>, <i>ever</i>, <u>EVER</u> beat
<font size="+4" color="red">OUR</font> prices!
</p>
HTML
Welcome to Greasy Joe's. You will never, ever, EVER beat OUR prices!
output
Tags such as b, i, u
and font
are discouraged in strict HTML
Why is this bad?
<head>
...
<link type="text/css" href="filename" rel="stylesheet" />
...
</head>
HTML (template)
<link type="text/css" href="style.css" rel="stylesheet" />
HTML (example)
CSS describes the appearance and layout of information on a web page (as opposed to HTML, which describes the content)
Can be embedded in HTML or placed into separate .css
file (preferred)
selector {
property: value;
property: value;
...
property: value;
}
CSS (template)
p {
color: red;
font-family: sans-serif;
}
CSS (example)
A CSS file consists of one or more rules
A rule selector specifies HTML element(s) and applies style properties
*
selects all elements