lecture02
lecture02
● First Assignment
● Recap Web vs Internet
● More HTML
○ You should not feel like you will know everything yet
○ and we continue learning more as we get into CSS and JS
● Discuss Accessible Design
● Start CSS
Creative Project 1: HTML and CSS
First assignment: Gaining practice with HTML and CSS. But… How?
Every assignment for the entire quarter will follow these steps:
🏠
Where does the house come from?
● References to houses or businesses, and the things you see inside of them.
● "If you want to talk to Alex, you can find them at 123 Street Way."
Refining the analogy
We'd never do this for real houses, but the web is more like:
For different types of pages, you may have more elements but there are the
ones you should follow as a guide for most of your web pages.
HTML vs. Rendered Web Page
<!DOCTYPE html>
<html>
<head>
<title>Koala Fan Page</title>
</head>
<body>
<header>
<h1>A Koala-tee Webpage</h1>
</header>
<main>
<aside>
<!-- Left sidebar -->
</aside>
<section>
<!-- Koala facts (header and paragraphs)-->
<article>
<!-- Koala art gallery -->
</article>
</section>
</main>
<footer>
<!-- Image citations -->
</footer>
</body>
</html>
HTML5 and Semantic Tags
<main>
Main content of the document - unlike <header> and <footer> tags, there can only
be one main element in the <body>. The content inside should be unique and not
contain content that is repeated across pages ( e.g. sidebars, nav link, search bars,
etc.)
<header>
Header element - contains header information for page body or section/article,
including logos, navigation bar, etc.
<footer>
Footer element - contains footer information for page body or section/article,
including copyright information, contact, links, etc. Also often used with block
quotes to cite sources (see CP1 about.html for an example!).
article vs. section
Articles are complete, standalone content. Sections are pieces of a greater whole.
And remember: div has no semantic meaning, should only be added for selecting
content in CSS/JS, and should be your "last resort"
Some important HTML Details
Links (Anchors): <a>
<p>
Search for it on <a href="http://www.google.com/">Google</a>!
</p>
code
Uses the href (Hypertext REFerence) attribute to specify the destination URL
● This can be absolute (to another web site) or relative (to another page on this
site)
Anchors are inline elements; must be placed in a block element such as a <p> or
Images: <img>
output
HTML5 also requires an alt attribute describing the image, which improves
accessibility for users who can't otherwise see it.
The value of the alt attribute is also what you see if the image is not successfully
loaded.
output
More about Images
If placed in an <a> anchor tag, the image becomes a link
<a href="https://courses.cs.washington.edu/courses/cse154/21sp/">
<img src="img/cse154logo.png" alt="CSE154 Course Logo" title="Logo">
</a> code
output
Relative vs. Absolute Paths for Links and Images
Absolute: paths refer to a specific location of a file, including the domain and protocol.
● Typically used when pointing to a link that is published online (not within your own
website).
● Example: "https://validator.w3.org/"
Citing External Material
<figure>
<!--
Image source: Wikipedia, Made by User:Golbez
[CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/)]
-->
<img
src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Australia_states_blank.png/
257px-Australia_states_blank.png"
alt="Koala-land map">
<figcaption>Koalas live in Australia</figcaption>
</figure>
In your CP's, you must cite all resources that were not original (and you should give your
own images credits) either on the page (as in about.html or in a footer) and/or in the page
source code.
More examples (view page source to see citation comments):
● Example 1 (citing your own images)
● Example 2 (citing other images)
Nested Lists
A list can contain another list:
<ul>
<li>Koalas are marsupials</li>
<li>Koalas like to eat Eucalyptus plants
<ul>
<li>
They take up to 100 hours to
digest their food!
</li>
</ul>
</li>
<li>
The latin name for koalas is
<em>Phascolarctos cinereus</em>
("ash-colored pouch bear")
</li>
</ul>
HTML Character Entities
A way of representing any Unicode character within a web page
character(s) entity
™© ™ ©
И И
Refer to this slide deck for a list of the common tags you should know, and MDN's
element reference for a much more comprehensive and detailed list (includes
browser compatibility for each!)
Nesting Tags
Tags can “nest” inside of other tags
<body>
<p>
This is a <em>really, <strong>REALLY</strong></em> awesome paragraph.
And here's a neat list:
</p>
<ol>
<li>with one list item</li>
<li>with another list item</li>
</ol>
</body> code
<p>
HTML is <em>really,
<strong>REALLY lots of</strong><em class="good"></em></em> fun!
</p> correct
How can we check? Gitlab HTML Validator
Gitlab Validation Guide
● Checks your HTML code to make sure it follows our official HTML syntax
● More picky than the browser, which may render bad HTML correctly
NOTE: To be eligible for full credit on your creative projects and homework
assignments you MUST validate all of your files and pass with no errors. Warnings
are ok.
Web Standards
Moreover, it is important to write proper HTML code and follow proper syntax
Why use valid HTML5 and web standards?
● More interoperable across different web browsers
● More likely that our pages will display correctly now and in the future
● To ensure accessibility
Accessible Design
Slides based on content from Profs. Richard Ladner, Jake Wobbrock, and Amy Ko.
This is another great resource to learn more about why/how to make websites
accessible!
Thinking about accessibility as web developers
Who uses the web?
What are the different ways people visit and interact with websites?
Why is it important to think about users when developing websites?
Disabilities
● Everyone has different abilities
● Nearly 1 in 5 people have a disability in the U.S. (from the U.S. Census)
● Some kinds of disabilities (from W3C Web Accessibility Initiative (WAI)):
○ Visual
○ Auditory
○ Speech
○ Physical
○ Cognitive, learning, and neurological
○ Behavioral
Temporary and Situational Disability
Disabilities can be temporary
● having a broken arm in a cast
● difficulty hearing after a loud concert
● iOS: Settings > General > Accessibility > VoiceOver > Hit the switch
● Android: Settings > Accessibility > Talkback > Hit the switch
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.
Views of disabilities
Medical view
● People with disabilities are patients who need treatment and/or cure.
Legal view
● People with disabilities have rights and responsibilities, such as access to public buildings, voting,
education, etc.
● Lawsuits can occur, but they should not be the motivating factor for making a system accessible
Sociocultural view
● Variation in ability is natural. "Disability" is caused by how society is designed, not by nature.
● Building for inclusion builds innovation (e.g., curb cuts, closed captioning)
Tools and Resources
From the A11y Project
● A really great compendium of resources
● An accessibility workshop from GHC'18
Tools
● Web Accessibility Evaluation Tool: http://wave.webaim.org/
● Color Schemes: http://colorbrewer2.org/
● Color blindness checker: http://www.color-blindness.com/coblis-color-blindness-simulator/
● Text readability: http://juicystudio.com/services/readability.php
Resources
● Web Content Accessibility Guidelines (something to know about when you apply for jobs):
https://www.w3.org/WAI/intro/wcag
● Teach Access Tutorial (general background and covers an important standard called ARIA).
http://teachaccess.org/initiatives/tutorial/
● Web design and development course by AccessComputing
http://www.washington.edu/accesscomputing/webd2/
● A11ycast - YouTube Videos to teach developers how accessibility works.
Accessible Web Design Principles
Welcome to Greasy Joe's. You will never, ever, EVER beat OUR prices!
output
● 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)
Basic CSS Rule Syntax
selector {
property: value;
property: value;
...
property: value;
} template
p {
color: red;
font-family: sans-serif;
} example