03 Styling the Markup / Responsive Design

Week 3
9/11

Introduction to CSS (Cascading Style Sheets). Cover the Mechanics of CSS: how CSS integrates with HTML. Demonstrate most-used properties. Activity: Highlight content using CSS selectors. Activity: Create selectors targeting markup. Make page look like Photoshop comp.

Responsive Design. The web is on display on iPhone and iPad screens to desktop computers. CSS media queries allow you to target each of these devices in one style sheet. Activity: Using media queries to target different devices.

Homework

1) Finish Content. 2) Turn Photoshop sketches into HTML / CSS wireframe. 3) Test CSS selectors by targeting each element and change its background color. Read chapters 7-10. Due: The following week.

Questions from Last Weeks Class or Homework?

Goals

The goals of this unit are to:

  • Learn how CSS works.
  • Apply CSS.
  • Understand responsive design with media queries.

Materials

Additional materials for this unit can be found by following these links:

Outcomes

At the end of this unit, students will have:

  • Incorporated user experience into the design process.
  • Know how to create inline, embedded and external style sheets.
  • Connected CSS definitions to the markup using selectors.
  • Understood the correct use of ids and classes.
  • Have explored the many CSS 2.1 properties in the interactive demos.
  • Incorporated media queries as the basis for future-proofing web design.

CSS Fun

Smartphones in CSS No pictures or images, just code.

History of the 311 City Services

Illustrating with CSS

Diana A Smith creates spectacular work using only HTML and CSS. Check out
Silhouette , Font made using only CSS, Cigario Poster, and Francine comes with an explanation. You can see the limitations of this technique if you zoom in to 400% but it is quite an accomplishment using mostly background blends , border radius, box shadow, 2D and 3D transforms and blending techniques.

Step-by-Step

15 Review homework and answer questions.
40 The Mechanics of CSS Explain CSS stylesheets. Exhibit the Safari Default Stylesheet and show how this is neutralized by the CSS Reset.
10 break
40 Explain media queries and responsive design
10 Explain homework
10 Read the book, and the definitions below

News and External Resources

Cheat Sheets that list all of the different HTML5 and CSS3 tags you can use. Print them out, use them. explore. You will be able to use these during the quiz:

  1. HTML5 Cheat Sheet all of the different tags and the attributes they can have.
  2. CSS3 Cheat Sheet all of the different properties and all possible values or value types they take.

Install these Plug-ins for Firefox and Chrome. They will facilitate your web development. Do not forget to activate the Show Developer menu in menu bar under the Advanced tab in Safari’s Preferences.

  1. Firebug Plug in for Firefox and Chrome.
  2. Web Developer Plug in for Firefox and Chrome.

Resources that will aid in your understanding of HTML and CSS.

  1. Google University: HTML, CSS and Javascript from the Ground Up.
  2. Can I use this CSS?Updated list of browser support.
  3. Dive Into HTML5Book on HTML5.
  4. W3.org Status of CSS level 3 specifications Keeper of the standards specifications used to create CSS support in the browsers.

Talking Points

Topics covered in the reading:

Chapter 7: CSS Building Blocks

  1. Constructing a Style Rule 181
  2. Adding Comments to Style Rules 182
  3. The Cascade: When Rules Collide 184
  4. A Property’s Value 188

Chapter 8: Working with Style Sheets

  1. Creating an External Style Sheet 198
  2. Linking to External Style Sheets 200
  3. Creating an Embedded Style Sheet 202
  4. Applying Inline Styles 204
  5. The Importance of Location 206
  6. Using Media- Specific Style Sheets 208
  7. Offering Alternate Style Sheets 210
  8. The Inspiration of Others: CSS 212

Chapter 9: Defining Selectors

  1. Constructing Selectors 214
  2. Selecting Elements by Name 216
  3. Selecting Elements by Class or ID 218
  4. Selecting Elements by Context 221
  5. Selecting Part of an Element 227
  6. Selecting Links Based on Their State 230
  7. Selecting Elements Based on Attributes 232
  8. Specifying Groups of Elements 236
  9. Combining Selectors 238
  10. Selectors Recap 240

Definitions

Definitions required to understand CSS:

  • rule or ruleset: A selector + braces combo, or an at-rule.
  • declaration block: A sequence of declarations.
  • declaration: A property + colon + value combo.
  • property value: The entire value of a property.
  • component value: A single piece of a property value. Like the 5px in text-shadow: 0 0 5px blue;. Can also refer to things that are multiple terms, like the 1-4 terms that make up the background-size portion of the background shorthand.
  • term: The basic unit of author-facing CSS, like a single number (5), dimension (5px), string ("foo"), or function. Officially defined by the CSS 2.1 grammar (look for the ‘term’ production)
  • outer <anything>: Refers to the margin box.
  • inner <anything>: Refers to the content box.
  • start/end/before/after: Refers to the logical directions, which are dependent on the ‘direction’ and ‘writing-mode’ properties. start and end are in the “inline” axis, the axis that a line of text is laid out in (horizontal in English text). Perpendicular to that, before and after are in the “block” axis, the axis that block elements are laid out in (vertical in English text).
  • simple selector: A single atomic selector, like a type selector, an attr selector, a class selector, etc.
  • compound selector: One or more simple selectors without a combinator. div.example is compound, div > .example is not.
  • complex selector: One or more compound selectors chained with combinators.
  • combinator: The parts of selectors that express relationships. There are four currently – the space (descendant combinator), the greater-than bracket (child combinator), the plus sign (next sibling combinator), and the tilda (following sibling combinator).
  • sequence of <anything> selectors: One or more of the named type of selector chained with commas.

The following terms are terms taken from w3.org CSS definition list. Many of these terms are technical, and for the sake of precision, these definitions obfuscate rather than clearly explores what they are saying, for most of them are really very basic. I though that exposure to the technical definitions would be a good idea:

Style sheet

A set of statements that specify presentation of a document.

Style sheets may have three different origins: author, user, and user agent. The interaction of these sources is described in the section on cascading and inheritance.

Valid style sheet

The validity of a style sheet depends on the level of CSS used for the style sheet. All valid CSS1 style sheets are valid CSS 2.1 style sheets but some changes from CSS1 mean that a few CSS1 style sheets will have slightly different semantics in CSS 2.1. Some features in CSS2 are not part of CSS 2.1, so not all CSS2 style sheets are valid CSS 2.1 style sheets.

A valid CSS 2.1 style sheet must be written according to the grammar of CSS 2.1. Furthermore, it must contain only at-rules, property names, and property values defined in this specification. An illegal (invalid) at-rule, property name, or property value is one that is not valid.

Source document

The document to which one or more style sheets apply. This is encoded in some language that represents the document as a tree of elements. Each element consists of a name that identifies the type of element, optionally a number of attributes, and a (possibly empty) content. For example, the source document could be an XML or SGML instance.
Document language

The encoding language of the source document (e.g., HTML, XHTML, or SVG). CSS is used to describe the presentation of document languages and CSS does not change the underlying semantics of the document languages.

Element

(An SGML term, see [ISO8879].) The primary syntactic constructs of the document language. Most CSS style sheet rules use the names of these elements (such as P, TABLE, and OL in HTML) to specify how the elements should be rendered.

Replaced element

An element whose content is outside the scope of the CSS formatting model, such as an image, embedded document, or applet. For example, the content of the HTML IMG element is often replaced by the image that its “src” attribute designates. Replaced elements often have intrinsic dimensions: an intrinsic width, an intrinsic height, and an intrinsic ratio. For example, a bitmap image has an intrinsic width and an intrinsic height specified in absolute units (from which the intrinsic ratio can obviously be determined). On the other hand, other documents may not have any intrinsic dimensions (for example, a blank HTML document).

User agents may consider a replaced element to not have any intrinsic dimensions if it is believed that those dimensions could leak sensitive information to a third party. For example, if an HTML document changed intrinsic size depending on the user’s bank balance, then the UA might want to act as if that resource had no intrinsic dimensions.

The content of replaced elements is not considered in the CSS rendering model.

Intrinsic dimensions

The width and height as defined by the element itself, not imposed by the surroundings. CSS does not define how the intrinsic dimensions are found. In CSS 2.1 only replaced elements can come with intrinsic dimensions. For raster images without reliable resolution information, a size of 1 px unit per image source pixel must be assumed.

Attribute

A value associated with an element, consisting of a name, and an associated (textual) value.

Content

The content associated with an element in the source document. Some elements have no content, in which case they are called empty. The content of an element may include text, and it may include a number of sub-elements, in which case the element is called the parent of those sub-elements.

Ignore

This term has two slightly different meanings in this specification. First, a CSS parser must follow certain rules when it discovers unknown or illegal syntax in a style sheet. The parser must then ignore certain parts of the style sheets. The exact rules for which parts must be ignored are described in these sections (Declarations and properties, Rules for handling parsing errors, Unsupported Values) or may be explained in the text where the term “ignore” appears. Second, a user agent may (and, in some cases must) disregard certain properties or values in the style sheet, even if the syntax is legal. For example, table-column elements cannot affect the font of the column, so the font properties must be ignored.

Rendered content

The content of an element after the rendering that applies to it according to the relevant style sheets has been applied. How a replaced element’s content is rendered is not defined by this specification. Rendered content may also be alternate text for an element (e.g., the value of the XHTML “alt” attribute), and may include items inserted implicitly or explicitly by the style sheet, such as bullets, numbering, etc.

Document tree

The tree of elements encoded in the source document. Each element in this tree has exactly one parent, with the exception of the root element, which has none.

Child

An element A is called the child of element B if and only if B is the parent of A.

Descendant

An element A is called a descendant of an element B, if either (1) A is a child of B, or (2) A is the child of some element C that is a descendant of B.

Ancestor

An element A is called an ancestor of an element B, if and only if B is a descendant of A.

Sibling

An element A is called a sibling of an element B, if and only if B and A share the same parent element. Element A is a preceding sibling if it comes before B in the document tree. Element B is a following sibling if it comes after A in the document tree.

Preceding element

An element A is called a preceding element of an element B, if and only if (1) A is an ancestor of B or (2) A is a preceding sibling of B.

Following element

An element A is called a following element of an element B, if and only if B is a preceding element of A.

Author

An author is a person who writes documents and associated style sheets. An authoring tool is a User Agent that generates style sheets.
User

A user is a person who interacts with a user agent to view, hear, or otherwise use a document and its associated style sheet. The user may provide a personal style sheet that encodes personal preferences.
User agent (UA)(otherwise known as a web browser)

A user agent is any program, for example, the web browser, that interprets a document written in the document language and applies associated style sheets according to the terms of this specification. A user agent may display a document, read it aloud, cause it to be printed, convert it to another format, etc.
An HTML user agent is one that supports one or more of the HTML specifications. A user agent that supports XHTML [XHTML] but not HTML is not considered an HTML user agent for the purpose of conformance with this specification.

Property

CSS defines a finite set of parameters, called properties, that direct the rendering of a document. Each property has a name (e.g., ‘color’, ‘font’, or border’) and a value (e.g., ‘red’, ’12pt Times’, or ‘dotted’). Properties are attached to various parts of the document and to the page on which the document is to be displayed by the mechanisms of specificity, cascading, and inheritance (see the chapter on Assigning property values, Cascading, and Inheritance).

03 CSS Browser Reset

Resetting the Browser style sheet

The browser has a default style sheet, and if you do not neutralize it, you will be adding your styles on top of its styles. Worse, different browsers can have different style sheets, and individuals can personalize the browser’s style sheet. An example: Safari’s default style sheet. To counter this we implement a css reset. There are two to choose from.

The first is by Eric Meyer, who created the first popular reset in 2007, and recently released this second version:

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

The second reset is called Normalize. It is a more nuanced approach that tries to do as little as possible and attempts to harmonize the browser defaults instead.

The aims of normalize.css are as follows:

  • Preserve useful browser defaults rather than erasing them.
  • Normalize styles for a wide range of HTML elements.
  • Correct bugs and common browser inconsistencies.
  • Improve usability with subtle improvements.
  • Explain the code using comments and detailed documentation.
/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */

/* Document
   ========================================================================== */

/**
 * 1. Correct the line height in all browsers.
 * 2. Prevent adjustments of font size after orientation changes in iOS.
 */

html {
  line-height: 1.15; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
}

/* Sections
   ========================================================================== */

/**
 * Remove the margin in all browsers.
 */

body {
  margin: 0;
}

/**
 * Correct the font size and margin on `h1` elements within `section` and
 * `article` contexts in Chrome, Firefox, and Safari.
 */

h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

/* Grouping content
   ========================================================================== */

/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
  overflow: visible; /* 2 */
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

pre {
  font-family: monospace, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/* Text-level semantics
   ========================================================================== */

/**
 * Remove the gray background on active links in IE 10.
 */

a {
  background-color: transparent;
}

/**
 * 1. Remove the bottom border in Chrome 57-
 * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
 */

abbr[title] {
  border-bottom: none; /* 1 */
  text-decoration: underline; /* 2 */
  text-decoration: underline dotted; /* 2 */
}

/**
 * Add the correct font weight in Chrome, Edge, and Safari.
 */

b,
strong {
  font-weight: bolder;
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

code,
kbd,
samp {
  font-family: monospace, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/**
 * Add the correct font size in all browsers.
 */

small {
  font-size: 80%;
}

/**
 * Prevent `sub` and `sup` elements from affecting the line height in
 * all browsers.
 */

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/* Embedded content
   ========================================================================== */

/**
 * Remove the border on images inside links in IE 10.
 */

img {
  border-style: none;
}

/* Forms
   ========================================================================== */

/**
 * 1. Change the font styles in all browsers.
 * 2. Remove the margin in Firefox and Safari.
 */

button,
input,
optgroup,
select,
textarea {
  font-family: inherit; /* 1 */
  font-size: 100%; /* 1 */
  line-height: 1.15; /* 1 */
  margin: 0; /* 2 */
}

/**
 * Show the overflow in IE.
 * 1. Show the overflow in Edge.
 */

button,
input { /* 1 */
  overflow: visible;
}

/**
 * Remove the inheritance of text transform in Edge, Firefox, and IE.
 * 1. Remove the inheritance of text transform in Firefox.
 */

button,
select { /* 1 */
  text-transform: none;
}

/**
 * Correct the inability to style clickable types in iOS and Safari.
 */

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
}

/**
 * Remove the inner border and padding in Firefox.
 */

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/**
 * Restore the focus styles unset by the previous rule.
 */

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/**
 * Correct the padding in Firefox.
 */

fieldset {
  padding: 0.35em 0.75em 0.625em;
}

/**
 * 1. Correct the text wrapping in Edge and IE.
 * 2. Correct the color inheritance from `fieldset` elements in IE.
 * 3. Remove the padding so developers are not caught out when they zero out
 *    `fieldset` elements in all browsers.
 */

legend {
  box-sizing: border-box; /* 1 */
  color: inherit; /* 2 */
  display: table; /* 1 */
  max-width: 100%; /* 1 */
  padding: 0; /* 3 */
  white-space: normal; /* 1 */
}

/**
 * Add the correct vertical alignment in Chrome, Firefox, and Opera.
 */

progress {
  vertical-align: baseline;
}

/**
 * Remove the default vertical scrollbar in IE 10+.
 */

textarea {
  overflow: auto;
}

/**
 * 1. Add the correct box sizing in IE 10.
 * 2. Remove the padding in IE 10.
 */

[type="checkbox"],
[type="radio"] {
  box-sizing: border-box; /* 1 */
  padding: 0; /* 2 */
}

/**
 * Correct the cursor style of increment and decrement buttons in Chrome.
 */

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

/**
 * 1. Correct the odd appearance in Chrome and Safari.
 * 2. Correct the outline style in Safari.
 */

[type="search"] {
  -webkit-appearance: textfield; /* 1 */
  outline-offset: -2px; /* 2 */
}

/**
 * Remove the inner padding in Chrome and Safari on macOS.
 */

[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/**
 * 1. Correct the inability to style clickable types in iOS and Safari.
 * 2. Change font properties to `inherit` in Safari.
 */

::-webkit-file-upload-button {
  -webkit-appearance: button; /* 1 */
  font: inherit; /* 2 */
}

/* Interactive
   ========================================================================== */

/*
 * Add the correct display in Edge, IE 10+, and Firefox.
 */

details {
  display: block;
}

/*
 * Add the correct display in all browsers.
 */

summary {
  display: list-item;
}

/* Misc
   ========================================================================== */

/**
 * Add the correct display in IE 10+.
 */

template {
  display: none;
}

/**
 * Add the correct display in IE 10.
 */

[hidden] {
  display: none;
}

03 Safari Default Style Sheet

/*http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css
 * The default style sheet used to render HTML.
 *
 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 
 * 2010, 2011 Apple Inc. All rights reserved.
 *
 * This library is free software; 
 * you can redistribute it and/or
 * modify it under the terms of the 
 * GNU Library General Public
 * License as published by the 
 * Free Software Foundation; either
 * version 2 of the License, 
 * or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; 
 * without even the implied warranty of
 * MERCHANTABILITY or FITNESS 
 * FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy 
 * of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  
 * If not, write to
 * the Free Software Foundation, Inc., 
 * 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

@namespace "http://www.w3.org/1999/xhtml";

html {
    display: block
}

/* children of the  element all have display:none */
head {
    display: none
}

meta {
    display: none
}

title {
    display: none
}

link {
    display: none
}

style {
    display: none
}

script {
    display: none
}

/* generic block-level elements */

body {
    display: block;
    margin: 8px
}

p {
    display: block;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1__qem;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
}

div {
    display: block
}

layer {
    display: block
}

article, aside, footer, header, hgroup, nav, section {
    display: block
}

marquee {
    display: inline-block;
    overflow: -webkit-marquee
}

address {
    display: block
}

blockquote {
    display: block;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 40px;
    -webkit-margin-end: 40px;
}

figcaption {
    display: block
}

figure {
    display: block;
    -webkit-margin-before: 1em;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 40px;
    -webkit-margin-end: 40px;
}

q {
    display: inline
}

q:before {
    content: open-quote;
}

q:after {
    content: close-quote;
}

center {
    display: block;
    /* special centering to be able to emulate the html4/netscape behaviour */
    text-align: -webkit-center
}

hr {
    display: block;
    -webkit-margin-before: 0.5em;
    -webkit-margin-after: 0.5em;
    -webkit-margin-start: auto;
    -webkit-margin-end: auto;
    border-style: inset;
    border-width: 1px
}

map {
    display: inline
}

/* heading elements */

h1 {
    display: block;
    font-size: 2em;
    -webkit-margin-before: 0.67__qem;
    -webkit-margin-after: 0.67em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

:-webkit-any(article,aside,nav,section) h1 {
    font-size: 1.5em;
    -webkit-margin-before: 0.83__qem;
    -webkit-margin-after: 0.83em;
}

:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 {
    font-size: 1.17em;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
}

:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 {
    font-size: 1.00em;
    -webkit-margin-before: 1.33__qem;
    -webkit-margin-after: 1.33em;
}

:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 {
    font-size: .83em;
    -webkit-margin-before: 1.67__qem;
    -webkit-margin-after: 1.67em;
}

:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 {
    font-size: .67em;
    -webkit-margin-before: 2.33__qem;
    -webkit-margin-after: 2.33em;
}

h2 {
    display: block;
    font-size: 1.5em;
    -webkit-margin-before: 0.83__qem;
    -webkit-margin-after: 0.83em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

h3 {
    display: block;
    font-size: 1.17em;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

h4 {
    display: block;
    -webkit-margin-before: 1.33__qem;
    -webkit-margin-after: 1.33em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

h5 {
    display: block;
    font-size: .83em;
    -webkit-margin-before: 1.67__qem;
    -webkit-margin-after: 1.67em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

h6 {
    display: block;
    font-size: .67em;
    -webkit-margin-before: 2.33__qem;
    -webkit-margin-after: 2.33em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

/* tables */

table {
    display: table;
    border-collapse: separate;
    border-spacing: 2px;
    border-color: gray
}

thead {
    display: table-header-group;
    vertical-align: middle;
    border-color: inherit
}

tbody {
    display: table-row-group;
    vertical-align: middle;
    border-color: inherit
}

tfoot {
    display: table-footer-group;
    vertical-align: middle;
    border-color: inherit
}

/* for tables without table section elements (can happen with XHTML or dynamically created tables) */
table > tr {
    vertical-align: middle;
}

col {
    display: table-column
}

colgroup {
    display: table-column-group
}

tr {
    display: table-row;
    vertical-align: inherit;
    border-color: inherit
}

td, th {
    display: table-cell;
    vertical-align: inherit
}

th {
    font-weight: bold
}

caption {
    display: table-caption;
    text-align: -webkit-center
}

/* lists */

ul, menu, dir {
    display: block;
    list-style-type: disc;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    -webkit-padding-start: 40px
}

ol {
    display: block;
    list-style-type: decimal;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    -webkit-padding-start: 40px
}

li {
    display: list-item
}

ul ul, ol ul {
    list-style-type: circle
}

ol ol ul, ol ul ul, ul ol ul, ul ul ul {
    list-style-type: square
}

dd {
    display: block;
    -webkit-margin-start: 40px
}

dl {
    display: block;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
}

dt {
    display: block
}

ol ul, ul ol, ul ul, ol ol {
    -webkit-margin-before: 0;
    -webkit-margin-after: 0
}

/* form elements */

form {
    display: block;
    margin-top: 0__qem;
}

label {
    cursor: default;
}

legend {
    display: block;
    -webkit-padding-start: 2px;
    -webkit-padding-end: 2px;
    border: none
}

fieldset {
    display: block;
    -webkit-margin-start: 2px;
    -webkit-margin-end: 2px;
    -webkit-padding-before: 0.35em;
    -webkit-padding-start: 0.75em;
    -webkit-padding-end: 0.75em;
    -webkit-padding-after: 0.625em;
    border: 2px groove ThreeDFace
}

button {
    -webkit-appearance: button;
}

/* Form controls don't go vertical. */
input, textarea, keygen, select, button, isindex, meter, progress {
    -webkit-block-flow: tb !important;
}

input, textarea, keygen, select, button, isindex {
    margin: 0__qem;
    font: -webkit-small-control;
    color: initial;
    letter-spacing: normal;
    word-spacing: normal;
    line-height: normal;
    text-transform: none;
    text-indent: 0;
    text-shadow: none;
    display: inline-block;
    text-align: -webkit-auto;
}

input[type="hidden"] {
    display: none
}

input, input[type="password"], input[type="search"], isindex {
    -webkit-appearance: textfield;
    padding: 1px;
    background-color: white;
    border: 2px inset;
    -webkit-rtl-ordering: logical;
    -webkit-user-select: text;
    cursor: auto;
}

input[type="search"] {
    -webkit-appearance: searchfield;
    -webkit-box-sizing: border-box;
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: searchfield-cancel-button;
    display: inline-block;
}

input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: searchfield-decoration;
    display: inline-block;
}

input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: searchfield-results-decoration;
    display: inline-block;
}

input[type="search"]::-webkit-search-results-button {
    -webkit-appearance: searchfield-results-button;
    display: inline-block;
}

#if defined(ENABLE_DATALIST) && ENABLE_DATALIST
input::-webkit-input-list-button {
    -webkit-appearance: list-button;
    display: inline-block;
}
#endif

input::-webkit-inner-spin-button {
    -webkit-appearance: inner-spin-button;
    display: inline-block;
    position: relative;
    cursor: default;
    vertical-align: top;
    -webkit-user-select: none;
}

#if defined(ENABLE_INPUT_SPEECH) && ENABLE_INPUT_SPEECH
input::-webkit-input-speech-button {
    -webkit-appearance: -webkit-input-speech-button;
    display: inline-block;
    vertical-align: top;
}
#endif

keygen, select {
    -webkit-border-radius: 5px;
}

keygen::-webkit-keygen-select {
    margin: 0px;
}

textarea {
    -webkit-appearance: textarea;
    background-color: white;
    border: 1px solid;
    -webkit-rtl-ordering: logical;
    -webkit-user-select: text;
    -webkit-box-orient: vertical;
    resize: auto;
    cursor: auto;
    padding: 2px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

input::-webkit-input-placeholder, isindex::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
    color: darkGray;
}

input[type="password"] {
    -webkit-text-security: disc !important;
}

input[type="hidden"], input[type="image"], input[type="file"] {
    -webkit-appearance: initial;
    padding: initial;
    background-color: initial;
    border: initial;
}

input[type="file"] {
    -webkit-box-align: baseline;
    text-align: start !important;
}

input:-webkit-autofill {
    background-color: #FAFFBD !important;
    background-image:none !important;
    color: #000000 !important;
}

input[type="radio"], input[type="checkbox"] {
    margin: 3px 0.5ex;
    padding: initial;
    background-color: initial;
    border: initial;
}

input[type="button"], input[type="submit"], input[type="reset"] {
    -webkit-appearance: push-button;
    white-space: pre
}

input[type="file"]::-webkit-file-upload-button {
    -webkit-appearance: push-button;
    white-space: nowrap;
    margin: 0;
}

input[type="button"], input[type="submit"], input[type="reset"], input[type="file"]::-webkit-file-upload-button, button {
    -webkit-box-align: center;
    text-align: center;
    cursor: default;
    color: ButtonText;
    padding: 2px 6px 3px 6px;
    border: 2px outset ButtonFace;
    background-color: ButtonFace;
    -webkit-box-sizing: border-box
}

input[type="range"] {
    -webkit-appearance: slider-horizontal;
    padding: initial;
    border: initial;
    margin: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: sliderthumb-horizontal;
    display: block;
}

input[type="button"]:disabled, input[type="submit"]:disabled, input[type="reset"]:disabled,
input[type="file"]:disabled::-webkit-file-upload-button, button:disabled,
select:disabled, keygen:disabled, optgroup:disabled, option:disabled {
    color: GrayText
}

input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]:active::-webkit-file-upload-button, button:active {
    border-style: inset
}

input[type="button"]:active:disabled, input[type="submit"]:active:disabled, input[type="reset"]:active:disabled, input[type="file"]:active:disabled::-webkit-file-upload-button, button:active:disabled {
    border-style: outset
}

area, param {
    display: none
}

input[type="checkbox"] {
    -webkit-appearance: checkbox;
    -webkit-box-sizing: border-box;
}

input[type="radio"] {
    -webkit-appearance: radio;
    -webkit-box-sizing: border-box;
}

#if defined(ENABLE_INPUT_COLOR) && ENABLE_INPUT_COLOR

input[type="color"] {
    -webkit-appearance: square-button;
    width: 44px;
    height: 23px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    display:-webkit-box;
    padding: 4px 2px;
    -webkit-box-sizing: border-box;
    width: 100%;
    height: 100%
}

input[type="color"]::-webkit-color-swatch {
    background-color: #000000;
    border: 1px solid #777777;
    -webkit-box-flex: 1;
}

#if defined(ENABLE_DATALIST) && ENABLE_DATALIST

input[type="color"][list] {
    -webkit-appearance: menulist;
    width: 88px;
    height: 23px;
}

input[type="color"][list]::-webkit-color-swatch-wrapper {
    padding-left: 8px;
    padding-right: 24px;
}

input[type="color"][list]::-webkit-color-swatch {
    border-color: #000000;
}

#endif // defined(ENABLE_DATALIST) && ENABLE_DATALIST

#endif // defined(ENABLE_INPUT_COLOR) && ENABLE_INPUT_COLOR

select {
    -webkit-appearance: menulist;
    -webkit-box-sizing: border-box;
    -webkit-box-align: center;
    border: 1px solid;
    white-space: pre;
    -webkit-rtl-ordering: logical;
    color: black;
    background-color: white;
    cursor: default;
}

select[size],
select[multiple],
select[size][multiple] {
    -webkit-appearance: listbox;
    -webkit-box-align: start;
    border: 1px inset gray;
    -webkit-border-radius: initial;
    white-space: initial;
}

select[size="0"],
select[size="1"] {
    -webkit-appearance: menulist;
    -webkit-box-align: center;
    border: 1px solid;
    -webkit-border-radius: 5px;
    white-space: pre;
}

optgroup {
    font-weight: bolder;
}

option {
    font-weight: normal;
}

output {
    display: inline;
}

/* form validation message bubble */

::-webkit-validation-bubble {
    display: inline-block;
    z-index: 2147483647;
    position: absolute;
    opacity: 0.95;
    line-height: 0;
    margin: 0;
    -webkit-text-security: none;
    -webkit-transition: opacity 05.5s ease;
}

::-webkit-validation-bubble-message {
    display: block;
    position: relative;
    top: -4px;
    font: message-box;
    color: black;
    min-width: 50px;
    max-width: 200px;
    border: solid 2px #400;
    background: -webkit-gradient(linear, left top, left bottom, from(#f8ecec), to(#e8cccc));
    padding: 8px;
    -webkit-border-radius: 8px;
    -webkit-box-shadow: 4px 4px 4px rgba(100,100,100,0.6),
        inset -2px -2px 1px #d0c4c4,
        inset 2px 2px 1px white;
    line-height: normal;
    white-space: normal;
    z-index: 2147483644;
}

::-webkit-validation-bubble-arrow {
    display: inline-block;
    position: relative;
    left: 32px;
    width: 16px;
    height: 16px;
    background-color: #f8ecec;
    border-width: 2px 0 0 2px;
    border-style: solid;
    border-color: #400;
    box-shadow: inset 2px 2px 1px white;
    -webkit-transform-origin: 0 0;
    -webkit-transform: rotate(45deg);
    z-index: 2147483645;
}

::-webkit-validation-bubble-arrow-clipper {
    display: block;
    overflow: hidden;
    height: 16px;
}

#if defined(ENABLE_METER_TAG) && ENABLE_METER_TAG
/* meter */

meter {
    -webkit-appearance: meter;
    -webkit-box-sizing: border-box;
    display: inline-box;
    height: 1em;
    width: 5em;
    vertical-align: -0.2em;
}

meter::-webkit-meter-bar {
    background: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#ddd), color-stop(0.20, #eee), color-stop(0.45, #ccc), color-stop(0.55, #ccc));
    height: 100%;
    width: 100%;
    -webkit-box-sizing: border-box;
}

meter::-webkit-meter-optimum-value {
    background: -webkit-gradient(linear, left top, left bottom, from(#ad7), to(#ad7), color-stop(0.20, #cea), color-stop(0.45, #7a3), color-stop(0.55, #7a3));
    height: 100%;
    -webkit-box-sizing: border-box;
}

meter::-webkit-meter-suboptimum-value {
    background: -webkit-gradient(linear, left top, left bottom, from(#fe7), to(#fe7), color-stop(0.20, #ffc), color-stop(0.45, #db3), color-stop(0.55, #db3));
    height: 100%;
    -webkit-box-sizing: border-box;
}

meter::-webkit-meter-even-less-good-value {
    background: -webkit-gradient(linear, left top, left bottom, from(#f77), to(#f77), color-stop(0.20, #fcc), color-stop(0.45, #d44), color-stop(0.55, #d44));
    height: 100%;
    -webkit-box-sizing: border-box;
}
#endif

#if defined(ENABLE_PROGRESS_TAG) && ENABLE_PROGRESS_TAG
/* progress */

progress {
    -webkit-appearance: progress-bar;
    -webkit-box-sizing: border-box;
    display: inline-block;
    height: 1em;
    width: 10em;
    vertical-align: -0.2em;
}

progress::-webkit-progress-bar {
    background-color: gray;
    height: 100%;
    width: 100%;
    -webkit-box-sizing: border-box;
}

progress::-webkit-progress-value {
    background-color: green;
    height: 100%;
    width: 50%; /* should be removed later */
    -webkit-box-sizing: border-box;
}
#endif

/* inline elements */

u, ins {
    text-decoration: underline
}

strong, b {
    font-weight: bolder
}

i, cite, em, var, address {
    font-style: italic
}

tt, code, kbd, samp {
    font-family: monospace
}

pre, xmp, plaintext, listing {
    display: block;
    font-family: monospace;
    white-space: pre;
    margin: 1__qem 0
}

mark {
    background-color: yellow;
    color: black
}

big {
    font-size: larger
}

small {
    font-size: smaller
}

s, strike, del {
    text-decoration: line-through
}

sub {
    vertical-align: sub;
    font-size: smaller
}

sup {
    vertical-align: super;
    font-size: smaller
}

nobr {
    white-space: nowrap
}

/* states */

:focus { 
    outline: auto 5px -webkit-focus-ring-color
}

/* Read-only text fields do not show a focus ring but do still receive focus */
html:focus, body:focus, input[readonly]:focus { 
    outline: none
}
  
input:focus, textarea:focus, isindex:focus, keygen:focus, select:focus {
    outline-offset: -2px
}

input[type="button"]:focus,
input[type="checkbox"]:focus,
input[type="file"]:focus,
input[type="hidden"]:focus,
input[type="image"]:focus,
input[type="radio"]:focus,
input[type="reset"]:focus,
input[type="search"]:focus,
input[type="submit"]:focus,
input[type="file"]:focus::-webkit-file-upload-button {
    outline-offset: 0
}
    
a:-webkit-any-link {
    color: -webkit-link;
    text-decoration: underline;
    cursor: auto;
}

a:-webkit-any-link:active {
    color: -webkit-activelink
}

/* HTML5 ruby elements */

ruby, rt {
    text-indent: 0; /* blocks used for ruby rendering should not trigger this */
}

rt {
    line-height: normal;
    -webkit-text-emphasis: none;
}

ruby > rt {
    display: block;
    font-size: 50%;
    text-align: -webkit-auto;
}

ruby > rp {
    display: none;
}

/* other elements */

noframes {
    display: none
}

frameset, frame {
    display: block
}

frameset {
    border-color: inherit
}

iframe {
    border: 2px inset
}

details {
    display: block
}

summary {
    display: block
}

summary::-webkit-details-marker {
    display: inline-block;
    width: 0.66em;
    height: 0.66em;
    margin-right: 0.4em;
}

/* page */

@page {
    /* FIXME: Define the right default values for page properties. */
    size: auto;
    margin: auto;
    padding: 0px;
    border-width: 0px;
}

/* noscript is handled internally, as it depends on settings. */
/*
 * The default style sheet used to render HTML.
 *
 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

@namespace "http://www.w3.org/1999/xhtml";

html {
    display: block
}

/* children of the  element all have display:none */
head {
    display: none
}

meta {
    display: none
}

title {
    display: none
}

link {
    display: none
}

style {
    display: none
}

script {
    display: none
}

/* generic block-level elements */

body {
    display: block;
    margin: 8px
}

p {
    display: block;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1__qem;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
}

div {
    display: block
}

layer {
    display: block
}

article, aside, footer, header, hgroup, nav, section {
    display: block
}

marquee {
    display: inline-block;
    overflow: -webkit-marquee
}

address {
    display: block
}

blockquote {
    display: block;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 40px;
    -webkit-margin-end: 40px;
}

figcaption {
    display: block
}

figure {
    display: block;
    -webkit-margin-before: 1em;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 40px;
    -webkit-margin-end: 40px;
}

q {
    display: inline
}

q:before {
    content: open-quote;
}

q:after {
    content: close-quote;
}

center {
    display: block;
    /* special centering to be able to emulate the html4/netscape behaviour */
    text-align: -webkit-center
}

hr {
    display: block;
    -webkit-margin-before: 0.5em;
    -webkit-margin-after: 0.5em;
    -webkit-margin-start: auto;
    -webkit-margin-end: auto;
    border-style: inset;
    border-width: 1px
}

map {
    display: inline
}

/* heading elements */

h1 {
    display: block;
    font-size: 2em;
    -webkit-margin-before: 0.67__qem;
    -webkit-margin-after: 0.67em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

:-webkit-any(article,aside,nav,section) h1 {
    font-size: 1.5em;
    -webkit-margin-before: 0.83__qem;
    -webkit-margin-after: 0.83em;
}

:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 {
    font-size: 1.17em;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
}

:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 {
    font-size: 1.00em;
    -webkit-margin-before: 1.33__qem;
    -webkit-margin-after: 1.33em;
}

:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 {
    font-size: .83em;
    -webkit-margin-before: 1.67__qem;
    -webkit-margin-after: 1.67em;
}

:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 {
    font-size: .67em;
    -webkit-margin-before: 2.33__qem;
    -webkit-margin-after: 2.33em;
}

h2 {
    display: block;
    font-size: 1.5em;
    -webkit-margin-before: 0.83__qem;
    -webkit-margin-after: 0.83em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

h3 {
    display: block;
    font-size: 1.17em;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

h4 {
    display: block;
    -webkit-margin-before: 1.33__qem;
    -webkit-margin-after: 1.33em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

h5 {
    display: block;
    font-size: .83em;
    -webkit-margin-before: 1.67__qem;
    -webkit-margin-after: 1.67em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

h6 {
    display: block;
    font-size: .67em;
    -webkit-margin-before: 2.33__qem;
    -webkit-margin-after: 2.33em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    font-weight: bold
}

/* tables */

table {
    display: table;
    border-collapse: separate;
    border-spacing: 2px;
    border-color: gray
}

thead {
    display: table-header-group;
    vertical-align: middle;
    border-color: inherit
}

tbody {
    display: table-row-group;
    vertical-align: middle;
    border-color: inherit
}

tfoot {
    display: table-footer-group;
    vertical-align: middle;
    border-color: inherit
}

/* for tables without table section elements (can happen with XHTML or dynamically created tables) */
table > tr {
    vertical-align: middle;
}

col {
    display: table-column
}

colgroup {
    display: table-column-group
}

tr {
    display: table-row;
    vertical-align: inherit;
    border-color: inherit
}

td, th {
    display: table-cell;
    vertical-align: inherit
}

th {
    font-weight: bold
}

caption {
    display: table-caption;
    text-align: -webkit-center
}

/* lists */

ul, menu, dir {
    display: block;
    list-style-type: disc;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    -webkit-padding-start: 40px
}

ol {
    display: block;
    list-style-type: decimal;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
    -webkit-padding-start: 40px
}

li {
    display: list-item
}

ul ul, ol ul {
    list-style-type: circle
}

ol ol ul, ol ul ul, ul ol ul, ul ul ul {
    list-style-type: square
}

dd {
    display: block;
    -webkit-margin-start: 40px
}

dl {
    display: block;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
}

dt {
    display: block
}

ol ul, ul ol, ul ul, ol ol {
    -webkit-margin-before: 0;
    -webkit-margin-after: 0
}

/* form elements */

form {
    display: block;
    margin-top: 0__qem;
}

label {
    cursor: default;
}

legend {
    display: block;
    -webkit-padding-start: 2px;
    -webkit-padding-end: 2px;
    border: none
}

fieldset {
    display: block;
    -webkit-margin-start: 2px;
    -webkit-margin-end: 2px;
    -webkit-padding-before: 0.35em;
    -webkit-padding-start: 0.75em;
    -webkit-padding-end: 0.75em;
    -webkit-padding-after: 0.625em;
    border: 2px groove ThreeDFace
}

button {
    -webkit-appearance: button;
}

/* Form controls don't go vertical. */
input, textarea, keygen, select, button, isindex, meter, progress {
    -webkit-block-flow: tb !important;
}

input, textarea, keygen, select, button, isindex {
    margin: 0__qem;
    font: -webkit-small-control;
    color: initial;
    letter-spacing: normal;
    word-spacing: normal;
    line-height: normal;
    text-transform: none;
    text-indent: 0;
    text-shadow: none;
    display: inline-block;
    text-align: -webkit-auto;
}

input[type="hidden"] {
    display: none
}

input, input[type="password"], input[type="search"], isindex {
    -webkit-appearance: textfield;
    padding: 1px;
    background-color: white;
    border: 2px inset;
    -webkit-rtl-ordering: logical;
    -webkit-user-select: text;
    cursor: auto;
}

input[type="search"] {
    -webkit-appearance: searchfield;
    -webkit-box-sizing: border-box;
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: searchfield-cancel-button;
    display: inline-block;
}

input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: searchfield-decoration;
    display: inline-block;
}

input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: searchfield-results-decoration;
    display: inline-block;
}

input[type="search"]::-webkit-search-results-button {
    -webkit-appearance: searchfield-results-button;
    display: inline-block;
}

#if defined(ENABLE_DATALIST) && ENABLE_DATALIST
input::-webkit-input-list-button {
    -webkit-appearance: list-button;
    display: inline-block;
}
#endif

input::-webkit-inner-spin-button {
    -webkit-appearance: inner-spin-button;
    display: inline-block;
    position: relative;
    cursor: default;
    vertical-align: top;
    -webkit-user-select: none;
}

#if defined(ENABLE_INPUT_SPEECH) && ENABLE_INPUT_SPEECH
input::-webkit-input-speech-button {
    -webkit-appearance: -webkit-input-speech-button;
    display: inline-block;
    vertical-align: top;
}
#endif

keygen, select {
    -webkit-border-radius: 5px;
}

keygen::-webkit-keygen-select {
    margin: 0px;
}

textarea {
    -webkit-appearance: textarea;
    background-color: white;
    border: 1px solid;
    -webkit-rtl-ordering: logical;
    -webkit-user-select: text;
    -webkit-box-orient: vertical;
    resize: auto;
    cursor: auto;
    padding: 2px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

input::-webkit-input-placeholder, isindex::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
    color: darkGray;
}

input[type="password"] {
    -webkit-text-security: disc !important;
}

input[type="hidden"], input[type="image"], input[type="file"] {
    -webkit-appearance: initial;
    padding: initial;
    background-color: initial;
    border: initial;
}

input[type="file"] {
    -webkit-box-align: baseline;
    text-align: start !important;
}

input:-webkit-autofill {
    background-color: #FAFFBD !important;
    background-image:none !important;
    color: #000000 !important;
}

input[type="radio"], input[type="checkbox"] {
    margin: 3px 0.5ex;
    padding: initial;
    background-color: initial;
    border: initial;
}

input[type="button"], input[type="submit"], input[type="reset"] {
    -webkit-appearance: push-button;
    white-space: pre
}

input[type="file"]::-webkit-file-upload-button {
    -webkit-appearance: push-button;
    white-space: nowrap;
    margin: 0;
}

input[type="button"], input[type="submit"], input[type="reset"], input[type="file"]::-webkit-file-upload-button, button {
    -webkit-box-align: center;
    text-align: center;
    cursor: default;
    color: ButtonText;
    padding: 2px 6px 3px 6px;
    border: 2px outset ButtonFace;
    background-color: ButtonFace;
    -webkit-box-sizing: border-box
}

input[type="range"] {
    -webkit-appearance: slider-horizontal;
    padding: initial;
    border: initial;
    margin: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: sliderthumb-horizontal;
    display: block;
}

input[type="button"]:disabled, input[type="submit"]:disabled, input[type="reset"]:disabled,
input[type="file"]:disabled::-webkit-file-upload-button, button:disabled,
select:disabled, keygen:disabled, optgroup:disabled, option:disabled {
    color: GrayText
}

input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active, input[type="file"]:active::-webkit-file-upload-button, button:active {
    border-style: inset
}

input[type="button"]:active:disabled, input[type="submit"]:active:disabled, input[type="reset"]:active:disabled, input[type="file"]:active:disabled::-webkit-file-upload-button, button:active:disabled {
    border-style: outset
}

area, param {
    display: none
}

input[type="checkbox"] {
    -webkit-appearance: checkbox;
    -webkit-box-sizing: border-box;
}

input[type="radio"] {
    -webkit-appearance: radio;
    -webkit-box-sizing: border-box;
}

#if defined(ENABLE_INPUT_COLOR) && ENABLE_INPUT_COLOR

input[type="color"] {
    -webkit-appearance: square-button;
    width: 44px;
    height: 23px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    display:-webkit-box;
    padding: 4px 2px;
    -webkit-box-sizing: border-box;
    width: 100%;
    height: 100%
}

input[type="color"]::-webkit-color-swatch {
    background-color: #000000;
    border: 1px solid #777777;
    -webkit-box-flex: 1;
}

#if defined(ENABLE_DATALIST) && ENABLE_DATALIST

input[type="color"][list] {
    -webkit-appearance: menulist;
    width: 88px;
    height: 23px;
}

input[type="color"][list]::-webkit-color-swatch-wrapper {
    padding-left: 8px;
    padding-right: 24px;
}

input[type="color"][list]::-webkit-color-swatch {
    border-color: #000000;
}

#endif // defined(ENABLE_DATALIST) && ENABLE_DATALIST

#endif // defined(ENABLE_INPUT_COLOR) && ENABLE_INPUT_COLOR

select {
    -webkit-appearance: menulist;
    -webkit-box-sizing: border-box;
    -webkit-box-align: center;
    border: 1px solid;
    white-space: pre;
    -webkit-rtl-ordering: logical;
    color: black;
    background-color: white;
    cursor: default;
}

select[size],
select[multiple],
select[size][multiple] {
    -webkit-appearance: listbox;
    -webkit-box-align: start;
    border: 1px inset gray;
    -webkit-border-radius: initial;
    white-space: initial;
}

select[size="0"],
select[size="1"] {
    -webkit-appearance: menulist;
    -webkit-box-align: center;
    border: 1px solid;
    -webkit-border-radius: 5px;
    white-space: pre;
}

optgroup {
    font-weight: bolder;
}

option {
    font-weight: normal;
}

output {
    display: inline;
}

/* form validation message bubble */

::-webkit-validation-bubble {
    display: inline-block;
    z-index: 2147483647;
    position: absolute;
    opacity: 0.95;
    line-height: 0;
    margin: 0;
    -webkit-text-security: none;
    -webkit-transition: opacity 05.5s ease;
}

::-webkit-validation-bubble-message {
    display: block;
    position: relative;
    top: -4px;
    font: message-box;
    color: black;
    min-width: 50px;
    max-width: 200px;
    border: solid 2px #400;
    background: -webkit-gradient(linear, left top, left bottom, from(#f8ecec), to(#e8cccc));
    padding: 8px;
    -webkit-border-radius: 8px;
    -webkit-box-shadow: 4px 4px 4px rgba(100,100,100,0.6),
        inset -2px -2px 1px #d0c4c4,
        inset 2px 2px 1px white;
    line-height: normal;
    white-space: normal;
    z-index: 2147483644;
}

::-webkit-validation-bubble-arrow {
    display: inline-block;
    position: relative;
    left: 32px;
    width: 16px;
    height: 16px;
    background-color: #f8ecec;
    border-width: 2px 0 0 2px;
    border-style: solid;
    border-color: #400;
    box-shadow: inset 2px 2px 1px white;
    -webkit-transform-origin: 0 0;
    -webkit-transform: rotate(45deg);
    z-index: 2147483645;
}

::-webkit-validation-bubble-arrow-clipper {
    display: block;
    overflow: hidden;
    height: 16px;
}

#if defined(ENABLE_METER_TAG) && ENABLE_METER_TAG
/* meter */

meter {
    -webkit-appearance: meter;
    -webkit-box-sizing: border-box;
    display: inline-box;
    height: 1em;
    width: 5em;
    vertical-align: -0.2em;
}

meter::-webkit-meter-bar {
    background: -webkit-gradient(linear, left top, left bottom, from(#ddd), to(#ddd), color-stop(0.20, #eee), color-stop(0.45, #ccc), color-stop(0.55, #ccc));
    height: 100%;
    width: 100%;
    -webkit-box-sizing: border-box;
}

meter::-webkit-meter-optimum-value {
    background: -webkit-gradient(linear, left top, left bottom, from(#ad7), to(#ad7), color-stop(0.20, #cea), color-stop(0.45, #7a3), color-stop(0.55, #7a3));
    height: 100%;
    -webkit-box-sizing: border-box;
}

meter::-webkit-meter-suboptimum-value {
    background: -webkit-gradient(linear, left top, left bottom, from(#fe7), to(#fe7), color-stop(0.20, #ffc), color-stop(0.45, #db3), color-stop(0.55, #db3));
    height: 100%;
    -webkit-box-sizing: border-box;
}

meter::-webkit-meter-even-less-good-value {
    background: -webkit-gradient(linear, left top, left bottom, from(#f77), to(#f77), color-stop(0.20, #fcc), color-stop(0.45, #d44), color-stop(0.55, #d44));
    height: 100%;
    -webkit-box-sizing: border-box;
}
#endif

#if defined(ENABLE_PROGRESS_TAG) && ENABLE_PROGRESS_TAG
/* progress */

progress {
    -webkit-appearance: progress-bar;
    -webkit-box-sizing: border-box;
    display: inline-block;
    height: 1em;
    width: 10em;
    vertical-align: -0.2em;
}

progress::-webkit-progress-bar {
    background-color: gray;
    height: 100%;
    width: 100%;
    -webkit-box-sizing: border-box;
}

progress::-webkit-progress-value {
    background-color: green;
    height: 100%;
    width: 50%; /* should be removed later */
    -webkit-box-sizing: border-box;
}
#endif

/* inline elements */

u, ins {
    text-decoration: underline
}

strong, b {
    font-weight: bolder
}

i, cite, em, var, address {
    font-style: italic
}

tt, code, kbd, samp {
    font-family: monospace
}

pre, xmp, plaintext, listing {
    display: block;
    font-family: monospace;
    white-space: pre;
    margin: 1__qem 0
}

mark {
    background-color: yellow;
    color: black
}

big {
    font-size: larger
}

small {
    font-size: smaller
}

s, strike, del {
    text-decoration: line-through
}

sub {
    vertical-align: sub;
    font-size: smaller
}

sup {
    vertical-align: super;
    font-size: smaller
}

nobr {
    white-space: nowrap
}

/* states */

:focus { 
    outline: auto 5px -webkit-focus-ring-color
}

/* Read-only text fields do not show a focus ring but do still receive focus */
html:focus, body:focus, input[readonly]:focus { 
    outline: none
}
  
input:focus, textarea:focus, isindex:focus, keygen:focus, select:focus {
    outline-offset: -2px
}

input[type="button"]:focus,
input[type="checkbox"]:focus,
input[type="file"]:focus,
input[type="hidden"]:focus,
input[type="image"]:focus,
input[type="radio"]:focus,
input[type="reset"]:focus,
input[type="search"]:focus,
input[type="submit"]:focus,
input[type="file"]:focus::-webkit-file-upload-button {
    outline-offset: 0
}
    
a:-webkit-any-link {
    color: -webkit-link;
    text-decoration: underline;
    cursor: auto;
}

a:-webkit-any-link:active {
    color: -webkit-activelink
}

/* HTML5 ruby elements */

ruby, rt {
    text-indent: 0; /* blocks used for ruby rendering should not trigger this */
}

rt {
    line-height: normal;
    -webkit-text-emphasis: none;
}

ruby > rt {
    display: block;
    font-size: 50%;
    text-align: -webkit-auto;
}

ruby > rp {
    display: none;
}

/* other elements */

noframes {
    display: none
}

frameset, frame {
    display: block
}

frameset {
    border-color: inherit
}

iframe {
    border: 2px inset
}

details {
    display: block
}

summary {
    display: block
}

summary::-webkit-details-marker {
    display: inline-block;
    width: 0.66em;
    height: 0.66em;
    margin-right: 0.4em;
}

/* page */

@page {
    /* FIXME: Define the right default values for page properties. */
    size: auto;
    margin: auto;
    padding: 0px;
    border-width: 0px;
}

/* noscript is handled internally, as it depends on settings. */

03 Absolute Positioning Demonstration

This will have happened before many of you were born, though I remember it well. In the late 1980 and the early 1990’s desktop publishing was born with programs like PageMaker, a program whose reincarnation would be named InDesign.

What liberated the designers was the ability to put content anywhere. Be it text or pictures, the content is always contained in a box. PageMaker and Indesign can position these boxes anywhere on the page.

Those who knew how these programs worked would make sure that they used the numerical coordinates to accurately position the boxes, and not just rely on guides or to do it by eye. It was easy to see how many inches a box was from the upper left corner of the document that represented the default 0 point.

Each box in InDesign (or Illustrator, for that matter) has four numbers associated with it: the horizontal distance (x) from the point of origin, the vertical distance (y), the width and the height. This is the same for each element that is absolutely positioned in HTML and CSS. We are going to use that to layout the bio.

The Document’s Default Behavior

In the first homework assignment you marked up content using heads <h1><h6> and paragraphs <p>, added links <a> and images<img>, and grouped certain content together using the generic <div> or the more semantic HTML5 tags like <header>, <nav>, <section>, <article>, <figure> and <figcaption>.

At this time you did not nest too many tags inside of other tags, but know that every tag you created was already nested as a child of the body tag. As you develop the layout, you will increasingly nest tags inside of one another, usually to define and group an area of the layout, like the header, right column, main content, navigation or footer.

When you look at the first assignment, you see the browser’s default style at work. The content vertically lines up, one below another, while the text flows left to right.

To better understand this structure, change the embedded style included in the HTML5 template, which currently looks like this:

<style type="text/css">
.example {
}
</style>

To an embedded style that puts an outline or border on all elements, like this:

<style type="text/css">
	body, section, header, nav, article, p, h1, h2, footer, nav, figure, figcaption, ol, ul, li { 
	outline: 2px solid red;
}
a, img, span, em, strong, a { 
	border: 2px solid green;
}
</style>

A red outline is put on the elements that are displayed according to the block mode and a green border is put on the elements that are displayed according to the inline mode.
example with borders

Each element of the assignment now has an outline or border.

Take a moment and explore the way the red outlined block elements stack below one another. Each element’s width extends all the way out to the parent by default.

Inline elements with green borders styles the content (type) in block elements, flowing from insertion point to the end of the box. It then start over on the next line. Not all languages flow horizontally or left to right, though english does, so we can say that type starts left and flows horizontally.

The default display of the content is that the block elements flow down one below the other from the top of the page The absolute display mode radically changes this by completely removes elements from the default document flow.

There is no need to keep this style, so you can remove it by commenting it out using the CSS commenting convention: /* comments */. That way it is still there is you ever want to see the block elements outlined in red.

It is also possible to just break a property inside a CSS rule by misspelling it, as it will just be ignored. Insert a special letter combination, and be consistent in your used of it, like -break-, as in out-break-line: 2px solid red;. It is the possible to quickly searched for -break- and find them. This is handy when stylesheets become big and need to be more carefully managed.

Styling the Elements

I use an embedded style sheet for this example, but you should use an external style sheet. You then need to write selectors that select all the elements on the page. You could do this by giving each element an id or class, but we want to be more efficient, and so first try to select the elements using type and pseudo selectors if possible.

The best selectors to use are type selectors. They select the element by its type, i.e. p for selecting all paragraphs. You can combine them to get more specific, like article div p, which targets only those paragraphs in the div in the article. If that doesn’t work, you can use the pseudo class selectors like :nth-child(N) or use class selectors if you want to target certain elements.

Avoid using ids, as they are much stronger than classes and tend to dominate the cascade hierarchy. To great a reliance on ids takes away a lot of the flexibility built into the CSS cascade.

Select each of the elements in the document and change the background color to know that you have successfully targeted that element with a CSS rule.

Altering the Default Layout Order

The block elements are like a child stacking playing blocks one on top of the other, only upside down, starting from the top with one box below the other. This is the normal document flow mode, and it is similar to how a word processor works. The difficulty of laying out a document using the normal document flow is that you have to build your way to every part of the document. The benefit is that if one thing changes, everything else adapts, if it’s done right.

Most Design students layout their documents using Indesign (Illustrator, or even Photoshop). The activity of creating and moving design elements where you want them is what layout is all about.

Forget the normal document flow! Click on an object and move it to where you want it to be.

A What You See is What You Get editor can do that, but the code it creates is messy. The best way to do this is coding the layout by hand. Go through the creative process, with thumbnails, mood boards etc., and develop a Photoshop comp before starting to code the layout.
wireframe

There is not much spontaneity in coding the layout, but then, there is little spontaneity in prepping an Indesign document for print. The creativity and spontaneity of web design happens in the early planning stages. To encourage that I ask you to show me your creative development in the worksheet. After that it’s mostly creative problem solving as you execute the layout. You are ahead of the game if you can see this as a puzzle to be solved.

Homework Assignment Using Absolute Positioning

To get started, we want to remove all of the background properties from the selector demo, so we can start with a clean slate.

Next, we want to center the layout in the middle of the window. That forces us to use a relatively positioned element as the containing element that wraps the website. So much for using only absolute positioning.

The way to horizontally center an element in CSS is to set the right and left margins on auto , and by giving the element a width. The width is subtracted from the width of the parent element, and whatever is left over is split into two so that equal side margins automatically center the element in the middle.

Absolute Position based on Relatively Positioned Parent

We also position this element as relative. This is an important step, for a page element with relative positioning gives you the control to absolutely position children elements inside of it. If we were to skip this step, the absolutely positioned elements would position itself to the body element, and not the automatically centering element just created.

The section element is made 960 pixels wide, and if the window is bigger than that, the margins are evenly divided, centering it in the window, or viewport, as it is technically called.

section { 
	position: relative; 
	margin: 0 auto; 
	width: 960px; 
	background: #888; 
	height: 900px;
}

Grouping Elements

The absolutely positioned elements inside of the section element will all stay centered in the window. This has the effect of grouping all of the enclosed elements. We will continue to use this technique to simplify our layout into the main HTML5 divisions, each one of which will be turned into a group: header, nav, aside, article and footer.

Header

All of the elements inside of the header element function as a group, allowing me to move them all by moving the header element.

Overlapping Elements

There is a shadow under the header element, but unlike most shadows, it does not stick out on one side. If it were to stick out, it would flatten the overall look by unifying the background and the page. I didn’t want that, so I made the element with the shadow property shorter. But that does not look right either.

To solve the problem I covered up the header element which has the shadow. The div inside of the header extends beyond its boundaries and covers up the shadow on the right side, as this picture demonstrates.

covering up the shadow illustration

There is no need to position the div element, since it is already where it is suppose to be. It has to be made the same height and just a little longer. To calculate the length of the div, add the 112px of padding on the left to the 848px in length. I took out the 1 px border on the sides, but left it in on the top and bottom. That makes it 960px wide, or 20 pixels longer than the header.

To calculate the height, add the 20 pixels of padding to the 90px in height, in addition to the 1px border on top and on the bottom. The div’s padding is what positions the title, which is then 112 pixels from the left and 20 pixels from the top of the header element.

Google Fonts are used, and the link to them has to be included in the header.

<link  href="http://fonts.googleapis.com/css?family=Anton:regular&v1" rel="stylesheet" type="text/css" >

The fonts can be called by using the font-family property. A shorthand version is used to combine the five font properties:

	font-family: 'Anton', serif;
	font-size: 48px;
	font-style: normal;
	font-weight: 400;
	line-height: 1.2;

To its shorthand equivalent:

	font: normal 400 48px/1.2em 'Anton', serif;

The picture of Piet is placed via absolute positioning from the right of the header div, its parent, and not the left. Since it sticks out above the header, it requires negative number for the top position. Here is the CSS:

header { 
	position: absolute; 
	top: 90px; 
	left: 0px;
	width: 940px; 
	height: 110px; 
	background: #eee; 
}
header div {
	width: 848px;
	height: 90px;
	padding: 20px 0 0 112px;
	background: #eee;
	border-top: 1px solid black; 
	border-bottom: 1px solid black; 
}
header h1 {
	color: #000;
	font: normal 400 48px/1.2em 'Anton', serif;
	font-family: 'Anton', serif;
	letter-spacing: 0.108em;
	word-spacing: 0em;
}
header figure { 
	position: absolute; 	
 	top: -70px;
 	right: 20px; 
	width: 280px;
	height: 260px;
}

And the HTML:

<header class="shadow_1"> 
	<div>
	<h1>Pete Mondrian</h1> 
	<figure class="shadow_2">
		<img src="images/Mondrian.jpg" alt="MONDRIAN himself" />
	</figure> 
	</div>
</header> 

That takes care of the header as a group. If we were to move it up or down, we could do so by changing only the header values.

Aside

The pictures on the left side make up the aside. The aside is pretty straight forward, as the pictures, which are 160px wide, fall into place once a width of 160px is specified. The figcaptions align up below the pictures. The HTML is as follows:

<aside>
	<figure>
		<img src="images/mondrian2.jpg" alt="Composition with Red, Yellow and Blue" />
		<figcaption>Composition with Red, Yellow and Blue</figcaption> 
	</figure> 
	<figure>
		<img src="images/mondrian3.jpg" alt="Composition No. III" />
		<figcaption>Composition No. III</figcaption>
	</figure> 
	<figure>
		<img src="images/mondrian4.jpg" alt="Composition No. II" />
		<figcaption>Composition No. II</figcaption>
	</figure> 
	<figure>
		<img src="images/mondrian5.jpg" alt="composition No. 10" />
		<figcaption>Composition No. 10</figcaption> 
	</figure> 
</aside>

and the CSS is:

aside { 
	position: absolute; 
	top: 200px;
}
aside figure {
	width: 160px;
	margin: 40px 0 40px 40px;
}
figcaption {
	font-size: 80%;
	color: #444;
	text-align: right;  
}

Nav

The navigation is absolutely positioned from the top of the page to just below the header picture. Though nothing was obstructing its view, the links were not working. Using the z-index property to raise it just off of the default layer exposed the link’s functionality. The anchor elements, or links, are displayed as block elements, and styled accordingly. The CSS:

nav {
	position: absolute;
	top: 300px;
	right: 80px;
	width: 120px;
	height: 140px;
	padding: 40px;
	background: #bbb;
	z-index: 1;
}
nav a {
	display: block;
	width: 100px;
	height: 25px;
	text-decoration: none;
	background: #ccc;
	padding: 5px 10px;
	margin: 3px 0;
	color: #333;
}
nav a:hover {
	text-decoration: none;
	background: #eee;
	color: #000;
}
nav a:active {
	text-decoration: none;
	background: #fcc;
	color: #000;

And the HTML:

<nav> 
	<h2 class="shadow_2">WORK</h2>
	<ul> 
		<li><a href="http://b.parsons.edu/~dejongo/12-fall/stuff/work_sheet_assignment-1.html">Assignment 1</a></li> 
		<li><a href="#">  placerat nec</a></li> 
		<li><a href="#"> tempor amet</a></li> 
		<li><a href="#"> varius sollici</a></li> 
	</ul> 
</nav>  

The navigation header and the article header are styled separately with the following CSS:

nav h2, article h2{
	position: absolute;
	top: -20px;
	left: 10px;
	height: 30px;
	width: 140px;
	padding: 8px 10px 10px;
	font: normal 400 24px/1.2em 'Anton', serif;
	letter-spacing: 0.108em;
	background: #ddd;
}

Article

The article is composed of one large picture and a div element that contains two columns. The figure falls into place. The figure is given extra padding on the bottom to push the div down. The div is given a background color, height, and padding to push the text of the first column both down and to the left. The width of the column is defined by the paragraph.

The second column is absolutely positioned so it sits beside the first. The title is given the same treatment as the nav title above.

article { 
	position: absolute; 
	top: 240px; 
	left: 240px;
}
article figure { 
	padding-bottom: 30px;
}
article div {
	position: absolute;
	margin-top: 10px;
	text-align: left;
	width: 620px;
	height: 400px;
	background: #ccc;
	line-height: 1.2;
	padding: 60px 0 0 60px;
}
article div p {
	Width: 260px;
}
.column2 {
	display: absolute;
	left: 320px;
	top: -10px;
	Width: 260px;
}

And the HTML:

<article>
	<figure>
		<img src="images/BroadwayBoogie.jpg" alt="Broadway Boogie Woogie" />
		<figcaption>Broadway Boogie Woogie</figcaption> 
	</figure>
	<div>
		<div class="column1">
			<h2 class="shadow_2">EXPERIENCE</h2>
			<p><a href="http://www.lipsum.com/">Lorem ipsum</a> dolor sit amet, consectetur adipiscing elit. Proin nec mi vitae arcu euismod sagittis eget vitae nunc. Integer eu mi felis. Nullam eleifend tincidunt magna. Cras ultrices est vel metus fermentum molestie. Maecenas ante elit, varius sollicitudin placerat nec, tempor sit amet dui. Nulla facilisi. Nam ac justo quis eros eleifend molestie in eget purus. Nulla facilisi. Sed dapibus, justo eu semper feugiat, eros turpis lobortis dolor, a malesuada sapien arcu sit amet sapien. Nulla aliquet lectus eget mauris molestie placerat.</p> 
		</div>
		<div class="column2">
			<p>Cras dolor metus. Proin diam nibh, sodales in hendrerit non, laoreet a dui. Proin tristique, sapien et mattis vestibulum, mi ante lobortis neque, in ultricies neque enim et diam.</p> 
			<p>Etiam id magna at arcu scelerisque iaculis vehicula ut tortor. In hac habitasse platea dictumst. Mauris a purus vitae lacus dictum, mi arcu porttitor velit, in aliquet tortor orci sed est. Mauris fringilla adipiscing dui, a pharetra odio porta in.</p> 
			<p>Etiam id magna at arcu scelerisque iaculis vehicula ut tortor. In hac habitasse platea dictumst. Mauris a purus vitae lacus dictum, mi arcu porttitor velit, in aliquet tortor orci sed est. Mauris fringilla adipiscing dui, a pharetra odio porta in.</p> 
		</div>
	</div>
</article> 

Footer

All that is left is the footer. Because absolutely positioned elements do not interact with the document flow, the footer cannot be positioned by the content itself. The last element is absolutely positioned, just like all the rest. The CSS:

	position: absolute; 
	top: 1100px; 
	width: 960px; 
}
footer a {
	display: block;
	width: 100%;
	padding: 5px 0;
	text-decoration: none;
	text-align: center;
	color: #444;
	background: #ddd;
}
footer a:hover {
	background: #222;
	color: #ddd
	}

And the HTML:

<footer> 
	<p> <a href="http://validator.w3.org/check?uri=referer"> Validate your page.</a> </p> 
</footer> 

The finished product. Absolute position of the elements works for print, because once the printed page is determined, the size no longer changes. That is not true of web design, and the next period will introduce a number of additional strategies to deal with layout out pages for the web.

03 The Mechanics of CSS


CSS, or cascading style sheets, describes the presentation of web pages, including colors, layout, and fonts. It does this through properties that style HTML elements.

Think form and content. CSS is the form, HTML the content.

CSS is separate from the content and is able to adapt the presentation of the content to different types of devices such as large screens, small screens, or printers.

The separation of CSS from HTML makes it easier to maintain sites, share style sheets across pages, and tailor pages to different environments.

CSS developed along side of HTML. Read its history here (by the creators of CSS).

CSS is deceptively easy to apply when it is done inline. That means you write the code right into the HTMl tags using the style attribute. You write these locally applied rules like this: style="inline CSS rules go here". The addition of the code style="color: red" to the paragraph tag <p > looks like <p style="color: red">, and colors the following paragraph red.

Changes are seen as soon as you update the browser. This immediacy and the simplicity of the syntax makes CSS appear easy, which it is when there is no cascade or style sheets to worry about.

It is possible to write all of your presentation in the tags themselves but you would find that to be highly inefficient. It is generally frowned upon to write CSS locally and defeats the purpose of the cascade.

What is CSS?

CSS gets its power from inheritance, the style sheets and the cascade. It is called CSS, or cascading style sheets. With that power comes the responsibility of keeping track of all the selectors that target the html element, and when there are many overlapping rules it can become difficult.

Not all properties are inheritable but those that are can be set in the <html> or <body> element, and every child element that is inside of these containing or parent elements, will inherit these properties.

The cascade describes how the CSS rules in the style sheet are applied globally. The CSS styles are a list of rules prefaced by one or more selectors. These rules can be placed in the header of the page or can be in an external style sheet, a blank text file saved with the .css extensiont, in which case, a link to that style sheet is placed in the header of the page.

Selectors provide the link between the rules in the style sheet and the HTML elements that receive the rule. The browser parses the document, figures out every element in the document tree, heals any errors it may find, and tracks all of the selectors used by the style sheet to target the different tags so that it can assign the rules of properties and their values to each element, so that the page ends up looking the way it does.

Inheritance

Every element is a child of the <html> element. If you target the <html> , or the <body> element, many properties will be inherited but not all.

For example, a child element inherits the font property of its parent but it will not inherit the background property. Other automatically inherited properties are: color, font (and related properties), letter-spacing, line-height, list-style (and related properties), text-align, text-indent, text-transform, visibility, white-space, and word-spacing.

Properties not automatically inherited are: background (and related properties), border (and related properties), display, float and clear, height and width, margin (and related properties), min- and max-height and -width, outline, overflow, padding (and related properties), position (and related properties), text-decoration, vertical-align, z-index. There are more but this gives you an idea.

Inheritance prevents certain properties from having to be declared over and over again in a style sheet allowing the developers to write less CSS and the users to view faster-loading pages.

Inheritance plays a large roll in CSS but it’s not overtly visible. Be aware that it’s constantly determining what the elements on the page look like. In the cascade, inherited properties lose out to any properties provided by a selector.

CSS Selectors

Central to this process is the selectors that connect the CSS properties to the element when the properties are no longer written in the element itself.

There are many kinds of selectors, and W3C has a whole list of them, I have a reduced set of them below. It is best to keep things simple and start with the type selector.

You can select all paragraphs in a document by using the type selector, like this: p {css property: value;}. It is possible to limit the scope and target only the paragraphs in the header for example. This is done by placing header before the p like this header p {css property: value;}.

An interactive demonstration can be of great help when conveying this information. What follows is the first of many such interactive demos.

Interactive CSS Selectors Demo

The following demonstration selects all of the text contained by <p> in this document. You can change the font, the type color and the type size (or anything else if you write in the rule).

Words inside of /* */ are comments. They are there to help you come up with values that match the properties. For example, /* green, #abc, hsl(35 100% 50% /1) */ are suggestions to replace black with green, blue grey or orange in color: black. You will see the content surrounded by <p> tags go to the default color black while typing in the new value. When CSS does not recognize a value it ignores it and applies the default value.

Your changes could render the document unreadable. To reset the document, refresh the page. The selector <p> selects all paragraph elements.

If you find something you like (this concerns other demos more than this one), copy the declaration and use it in your project.

CSS Code View

If you colored the text green, you will notice that the paragraph above that was originally colored red is still colored red. Why did the color not change? The same is true of the font-family.

We will explore this in much greater detail but know that the cascade determines which rule wins out over all the other rules that target the element.

You can overpower the cascade order by using !important, which is inserted right after the value and before the semicolon. Try inserting green !important in the demo, and you will see that the global CSS rules now override the local inline rules in the cascade. The red type in the introduction will be green.

The !important quickly destroys the cascade and quickly makes the CSS unusable, so it is not recommended unless you have no other options. I use it mostly for testing purposes, to check on whether I’m actually targeting an element or not in WordPress template that I did not create.

Specificity and Grouping Selectors

It’s not always desirable to select all the paragraphs in the document. We usually want to select very specific paragraphs, or elements, in the document. This paragraph or that paragraph but not all of them. This is achieved including one or more containing or parent elements, each separated by a space.

Selectors move up the DOM tree to achieve greater specificity. In the following demonstration, each line is targeted individually by nesting the selectors. Use a space “ ” between selectors to specifically select the child element inside of the parent element:

Selectors can also be grouped to share the same rule. Use a comma “ ,” between the selectors to include all of the selectors to which the rule will be applied. This is the case with the last two selector in this demonstration:

CSS Code View

Header in div

Paragraph in div

  1. Item 1 of list in div
  2. Item 2 of list in div

The blue div has the 120% applied twice, and is larger than all other text in this demonstration. Another example of the cascade at work. Play around with the demo to see how specificity is able to narrow the targeted section to exactly the element that you want to style.

The HTML code for this example is:

<div id="example0">
	<h2>Header in <span>div</span></h2>
	<p>Paragraph in <span>div</span>
	<ol>
		<li>Item 1 of list in <span>div</span>
		<li>Item 2 of list in <span>div</span>
	</ol>
</div>


CSS Rule Placement

There are three places where to put style definitions. CSS styles can be written in the tag itself, called inline styles, in the head of the document, called embedded styles and in an external style sheet.

Inline Style definitions

You can write the style directly in the tag itself. The attribute style has as its value whatever properties are to effect the HTML element style="color: red".

 <p style="color: red">

Embedded Style definitions

The CSS can be put in the <head> of the document between <style> and </style> tags. Using a p selector it’s possible to target all the paragraphs in the document with the embedded style.

<style type="text/css"> 
p { color: red}
</style>

The declarations are now enclosed in brackets and is called the declaration box, and in front of the bracket is the selector that targets which element is to be affected by the rule. The rule can be applied to many elements. Many rules can target the same elements and that increases the complexity. Different selectors with conflicting rules can target the same element. Which rule will win out to style the element? That is the question.

This is were it can get difficult as several rules can target the same element. When that happens, the browser has to select which rule wins out in what’s called the cascade.

Embedding the styles is more efficient than writing them in each paragraph element but it’s still not ideal, since the rules can only targets the HTML elements in the page. Websites almost always consist of multiple pages.

External Style Sheets

The most efficient place for styles is in an external style sheet. The external style sheet is a simple text file saved with a .css extension with nothing but CSS style rules on it. They can be written in any way, as spaces, returns and tabs are ignored by the browser. Start out by separating all of the properties in their own line, as in the following example, so that they are easy to read:

p {
	color: red; 
	background: white; 
	width: 400px; 
	padding: 20px; 
	border: 2px solid green; 
	margin: 20px auto;
}

It’s also possible to write the declarations in one line:

p {color: red; background: white; width: 400px; padding: 20px; border: 2px solid green; margin: 20px auto;}

There is no difference, as all the white space is collapsed. I tend to write all of my declarations in one line as that reduces scrolling in long style sheets. Once I finish I sometimes clean the styles so each declaration is on its own line.

The file is saved with a .css extension, often in its own folder called CSS, in case there are more than one external or imported style sheets. Note that it is required to exit the folder when linking to an external resource like a picture: use ../ in front of the resource to get out of the css folder.

Each HTML page in the site refers to that style sheet by linking to it by including the following code in the header of each document:

<link rel="stylesheet" href="css/styles.css" media="all">

You can copy this into your pages, though it is already included it in the HTML5 template.

It’s possible to link to or import several style sheets and some think it’s a good organizing principle to break the styles into several style sheets like the CSS reset, typography, navigation, layout or alternate styles for depreciated browsers.

The downside to all this organization is that each stylesheet requires a server request. That is, your browser has to ask the server for one more file to complete the page. The lag time involved in asking the server for each style sheet can take more time than the actual loading of the stylesheet itself. Because of this a more common approach is to put all the styles into a single style sheet.


Browser Style Sheets

There are three style sheets.

User Agent styles are the default style sheet the browser uses, which are modifiable by an end user.

Author Styles are the styles that you create when you design the page.

User Styles style information specified by the user apart from the default style sheet.


Browser’s Default Style Sheet

Even if you do not write any CSS, the HTML has formatting applied, so that an <h1> tag looks different from an <h2> or a <p> tag. Where do these styles come from?

Every browser has a default style sheet, called the user agent style sheet, like this one from Safari that formats the markup.

If you look at Safari’s default style sheet, you will see that it determines how the p element is to be displayed:

p {
    display: block;
    -webkit-margin-before: 1__qem;
    -webkit-margin-after: 1__qem;
    -webkit-margin-start: 0;
    -webkit-margin-end: 0;
}

A paragraph not yet styled looks as specified by the browser style sheet. If you start styling the elements with your own styles in an author style sheet, they are built on top of the styles specified in the user agent style sheet. That may lead to problems when the page is looked at in a different browser. To solve that problem a CSS reset is used.

Resetting Browser Default Style

To counteract the possibility that your author styles change with different browsers, you need to neutralize the default user agent style sheet the browser uses.

To counter this we implement a CSS reset. The CSS reset was initiated by Eric Meyer, and he recently released a second version. Take the following code and place it at the beginning of your style sheet, and it will neutralize the default styles of the browser style sheet.

/* Begin CSS Reset */
/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}
/* End CSS Reset */

A more nuanced CSS reset is accomplished by normalize.

Last Style Definition Wins

There is a pattern here. The styles in the author style sheet override the styles in the user agent style sheet. In the order in which CSS rules are compiled, subsequent declarations override previous ones.

If you repeat the same property twice, the second one will style the element. {color: green; color: red} The type will be colored red, not green.

This is also true of the three places where you can place the rules. If the same rule is found in the user agent style sheet, the author’s style sheet and any other imported external style sheets, the embedded or internal style sheet and repeated once again inline, that is, in the element itself, guess which rule wins out?

The inline rule wins out. The rule of thumb here is that the closer the style definition is to the element being styled, the more likely it is to triumph over the other rules and style the element. The insight we are given is that the order in which the browser concatenates the various style sheets is as given above, with the default style sheet first, then external style sheets, then the internal style sheet and finally it arrives at the elements themselves.

That the last style definition wins is part of the cascade:


The Cascade

CSS stands for cascading style sheets. The cascade is the ordering of selectors that determines which selector wins out over to style the element. In writing CSS you intentionally determine the cascade by how each selector targets their element(s).

CSS rules can be written in a number of places. In each place it is possible to have many declarations targeting the same HTML element. It is, therefore likely that element are targeted by several rules at once — from inline rules to embedded rules to external rules, to user stylesheets. When there are several rules targeting the same property with different values, only one of these rules wins out to determine the presentation of the HTML element. Figuring out which rule ends up styling the element is important.That is why it is necessary to figure out how the cascade works.

For example, <span style="color: red">red</span> this text’s inherited default color of black is overridden by the inline style that colors the type red. That tells you that the inline style trumps the inherited style.

The browser needs to figure out which rule to use when there are multiple conflicting values for a property. The cascade refers to the selection process in which these styles are evaluated so that only one value ends up styling the element.

Generally speaking, the closer a style definition is to the tag, the more likely it wins out. The inline style wins out over the embedded style, the embedded style trumps a linked or imported style sheet which in turn wins over the browser’s default style sheet, and they all trump inherited styles.

The cascade takes the selector’s specificity into its calculation. One selector ends trumping all the other selectors. There is a formula that determines the cascade. It prioritizes ids over classes, for example. Classes win out over structural tags and structural tags trump typed tags.

The new CSS transition and animation take top spots.

You can pull out the big gun and place !important after a rule if you absolutely want it to be the case no matter what.

Be judicious in your use of classes, ids, and especially !important, as you can easily make a document unmanageable. The rule of thumb is to use as low a cascade value as possible to select an element.

A fun interactive explanation of how the CSS cascade works It explains the cascade hierarchy in importance, origin, specificity, and position, and quizzes you on each of these points. If in doubt, take the quiz.


Cascade Layers

Cascade Layers are designed to ease CSS development on large projects. Cascade Layers provides a powerful way to organize styles into layers, where specificity is calculated independently inside each layer.

picture describes cascade layers

/* establish the layer order, so the "override" layer takes precedence */
@layer framework, override;

@layer override {
  @keyframes slide-left {
    from { translate: 0; }
    to { translate: -100% 0; }
  }
}

@layer framework {
  @keyframes slide-left {
    from { margin-left: 0; }
    to { margin-left: -100%; }
  }
}

.sidebar { animation: slide-left 300ms; }

In this case the override layer has a higher cascade priority than the framework layer, so slide-left will animate using the translate property rather than margin-left.

Cascade Layers are for advanced websites and are outside the scope of this class.


The Elements of a CSS Rule

CSS has a simple syntax and uses a number of English keywords to specify the names of various style properties and values. That makes it easy to use. A style sheet consists of a list of rules. Each rule or rule-set consists of one or more selectors and a declaration block. A declaration-block consists of a list of declarations in braces. Each declaration itself consists of a property, a colon :, and a value. If there are multiple declarations in a block, a semi-colon ; must be inserted to separate each declaration. The rule-set is applied to the target element by a selector. The combination of a selector with a rule-set completes the CSS statement.

The CSS Rule

The CSS rule contains both the selectors and the declarations.

Example: h1 {font-size:1.5em; font-weight: 700; color: #333; }

The Declaration

The declaration is a property-value pair and is part of the rule that describes how the selector will style the element. When the style sheet is embedded in the document, convention is to follow each declaration inline:
Example: h1 { font-size:1.5em; font-weight: 700; color: #333;}

While in an external style sheet, convention is the put each delectation on a new line with a tab in front:
Example: h1{
    font-size:1.5em;
    font-weight: 700;
    color: #333;
}

With the advent of @media queries in responsive design my preference is to write all CSS rules inline to minimize scrolling.

The Declaration Box

Declarations determines how the selector will style the element. it’s always bookended by curly braces { }.

Example: h1 { font-size:1.5em; font-weight: 700; color: #333;}

Properties

A property describes an aspect of an elements’s presentation such as color, font-size or border-width. The property is always followed by a value and the two are always separated by a colon:. There are a lot of properties, so it’s best to have a place where you can look them up, though repetition will acquaint you with the ones you need.

Example: h1 {color: #356590; padding: 3px 16px;}

Values

A value describes a specific appearance, such as a specific width, the name of a color, or some set value, such as for text-decoration: none; which removes the underline from text, often used to remove the underline that the browser’s default stylesheet gives a link. The value commences the declaration statement, and you signify that to the computer by using a semicolon ;. While it’s not necessary to tell the browser that there are no more declarations in the declaration box, it’s a good practice to close the last declaration as well.

Example: h1 {color:#356590; padding: 3px 16px;}

CSS Selectors

Selectors are patterns that match the elements of a document that will then have the declarations applied to them.

The easiest selector to understand is the type selector, in which p selects the paragraph element: <p>.

Selector Hierarchy

There are six different types of selectors,

  1. type
  2. universal
  3. attribute
  4. pseudo class
  5. class
  6. ID

The type selector selects the element by the tag itself:

Type: p { }

Use the type selector whenever possible. Use other selectors when the type selector cannot target an element.

The universal selector selects all elements:

Universal: * { }

The scope of the universal selector can be restricted through specificity.

Universal: nav * { }

The universal selector only selects all elements inside the nav element.

The attribute selector selects elements on the basis of their attributes. Example of attribute selector selecting all image tags with an attribute of “alt”:

Attribute: img[alt] { }

Example of attribute selector selecting all links to pdf files.

Attribute: a[href$=".pdf"] {color: #45a2f4;}

The pseudo class selects different states of an element, most often used to target the different states of a link like hover.

Pseudo Class: a:hover { }

The class selector selects all elements belonging to the same class on a page. Example of a class selector that selects any element with a class=”example”:

Class: .example { }

Example of a pseudo selector that selects any link and creates a hover class:

The ID selector selects an ID attribute. The value of each ID should be unique, assigned to only one element per page. Example of a ID selector that selects any element with an id=”container”:

ID: #container { }

Selecting, Specificity and Grouping Selectors

Use a space   to separate nested elements. body header nav ul li a would target the link in the nav of the header. Easier to use only the required elements header nav a. That would get all links in the nav contained in the header. If there were no other navs in the document, you could get alway with nav a

To make selecting elements more precise:

  • selectors can be combined by using a comma ,
  • a greater than sign > for limiting that combination to a child of the selected parent
  • a plus sign + for selecting the following sibling, meaning the directly adjacent element
  • and the tilde ~ for selecting indirectly adjacent selectors. For example, #french~p selects all the ps that are adjacent selectors of the element that has id="french".

Space: article p { } selects all <p> elements in <article>.

Greater Than: article>p { } selects only the <p> elements that are children of the <article>.

Adjacent: article+p { } selects only the <p> elements adjacent to the <article>.

Tilde: article~p { } selects all indirectly adjacent <p> elements to the <article>.

Grouping Selectors:

When several selectors share the same declarations, they can be grouped into a comma-separated , list:

example: h1, p, img, nav { }

Pseudo Class Selectors

Pseudo classes are based on the structure of the document rather than attributes or things found in the document.

A pseudo-class selector acts as if you have added a class to an element in your markup. It defines a special state of an element. It can be used to style an element when a user mouses over it, style visited and unvisited links and style an element when it gets focus.

Pseudo-class selectors make it possible to select the first, last or alternate lines to alternate the color in a set of links, for example:
First Child: tr:first-child { }
Last Child: tr:last-child { }
Nth Child: p:nth-child(2) { }
Nth Child: p:nth-child(odd) { }
Nth Child: p:nth-child(even) { }

Pseudo Classes

Pseudo classes create a class of an element that already exists but where there is no predetermined class. You can select a link, the anchor tag but there is no class to select the hover state of that link. This pseudo-class selector creates a pseudo class that can be styled as the link’s hover state. Many of these pseudo classes are structural, meaning that they use information that lies in the document tree to select different elements.

here is a list of pseudo classes:

:nth-child(N)

Matches elements on the basis of their positions within a parent element’s list of child elements (N here stands for the number of the element but it can also support odd and even, as in li:nth-child(odd)).

:nth-last-child(N)

Matches elements on the basis of their positions within a parent element’s list of child elements.

:nth-of-type(N)

Matches elements on the basis of their positions within a parent element’s list of child elements of the same type. CodePen

:nth-last-of-type(N)

Matches elements on the basis of their positions within a parent element’s list of child elements of the same type.

:last-child

Matches an element that’s the last child element of its parent element.

:first-of-type

Matches the first child element of the specified element type.

:last-of-type

Matches the last child element of the specified element type. CodePen

:only-child

Matches an element if it’s the only child element of its parent.

:only-of-type

Matches an element that’s the only child element of its type.CodePen

:empty

Matches elements that have no children. CodePen

:target

Matches an element that’s the target of a fragment identifier in the document’s URI.

:checked Pseudo-class

Matches elements like checkboxes or radio buttons that are checked.

:not(S)

Matches elements that aren’t matched by the specified selector. It is useful to exclude elements from a particular selection.


Pseudo Classes: not

Sophisticated example of the pseudo class not.A collapsable guide to the layout modes. All of the work is being done by the last CSS rule using the pseudo class not, as in not target or hover li:not(:target):not(:hover) .

CSS Code View

Live Demo

Here you will find links to the layout modes article, including the document flow, the positioning of the elements within the document flow and display, z-index and overflow properties.


Ids and Classes

HTML uses the Id and Class attributes for general naming of the elements. This is used by Javascript as well as CSS to select these elements.

In the markup the id uses a hash mark # before the name #this in the style sheet and the HTML code looks like <div id="this">, while the class uses a period . before the name .that in the style sheet and the HTML code looks like <div class="that">.

An id is to be assigned only once per page, while classes can be assigned multiple times per page. That difference gives ids more weight than classes when it comes to the CSS cascade.

Ids and Classes so obviously connect the rule with the element that they were over-used in the past when other selectors could have worked just as well. If it were a screaming contest, it was an outright cacophony. That particular affliction, along with the overuse of the generic div element, is called divitis and classitis. It is best to be as quiet as possible, and not jump to using classes and ids unless necessary.


Pseudo Elements

CSS can create markup where there is none. These are called Pseudo Elements, and you can style them as if they existed.

For Example, if you wanted to style the first letter of a paragraph, you can target it even though there is no markup. There are four pseudo elements all together: ::first-letter, ::first-line, ::before and ::after. All of them are written using another selector, two colons :: and the pseudo element, as in p::first-letter {} (The double colon is new, so a single colon is also accepted). Some use cases for before and after.

03 Applying CSS


There are many CSS properties. You do not have to memorize them all. You will remember the ones you use most often, and the other ones you can always look up. I’ve separated many of the properties into a number of interactive demos so that you can try them out. Spend some time in this sandbox, change the values of the properties or add new properties. This is where you can play and learn while it is still fun.

Color

Color is always RGB. That is how computers work. These are additive colors, you can call them by name or RGB value, both by percentages, decimal number or hexadecimal shorthand (Hexadecimal is base 16, or 1,2,3,4,5,6,7,8,9,a,b,c,d,e,f ), which is the most common form, introduced by a # hash mark, and allows each value (red, green and blue) to be represented by two Hexadecimal values, like #000000 is black or #ff0000 is red, #00ff00 is green and #0000ff is blue. Can you guess what the value of white is? If you guessed #000000, you are correct!

Here are the names of the colors, with their Hexadecimal and decimal numbers as an example:

Color Color name Hex rgb Decimal

    aliceblue #f0f8ff 240,248,255

    antiquewhite #faebd7 250,235,215

    aqua #00ffff 0,255,255

    aquamarine #7fffd4 127,255,212

    azure #f0ffff 240,255,255

    beige #f5f5dc 245,245,220

    bisque #ffe4c4 255,228,196

    black #000000 0,0,0

    blanchedalmond #ffebcd 255,235,205

    blue #0000ff 0,0,255

    blueviolet #8a2be2 138,43,226

    brown #a52a2a 165,42,42

    burlywood #deb887 222,184,135

    cadetblue #5f9ea0 95,158,160

    chartreuse #7fff00 127,255,0

    chocolate #d2691e 210,105,30

    coral #ff7f50 255,127,80

    cornflowerblue #6495ed 100,149,237

    cornsilk #fff8dc 255,248,220

    crimson #dc143c 220,20,60

    cyan #00ffff 0,255,255

    darkblue #00008b 0,0,139

    darkcyan #008b8b 0,139,139

    darkgoldenrod #b8860b 184,134,11

    darkgray #a9a9a9 169,169,169

    darkgreen #006400 0,100,0

    darkgrey #a9a9a9 169,169,169

    darkkhaki #bdb76b 189,183,107

    darkmagenta #8b008b 139,0,139

    darkolivegreen #556b2f 85,107,47

    darkorange #ff8c00 255,140,0

    darkorchid #9932cc 153,50,204

    darkred #8b0000 139,0,0

    darksalmon #e9967a 233,150,122

    darkseagreen #8fbc8f 143,188,143

    darkslateblue #483d8b 72,61,139

    darkslategray #2f4f4f 47,79,79

    darkslategrey #2f4f4f 47,79,79

    darkturquoise #00ced1 0,206,209

    darkviolet #9400d3 148,0,211

    deeppink #ff1493 255,20,147

    deepskyblue #00bfff 0,191,255

    dimgray #696969 105,105,105

    dimgrey #696969 105,105,105

    dodgerblue #1e90ff 30,144,255

    firebrick #b22222 178,34,34

    floralwhite #fffaf0 255,250,240

    forestgreen #228b22 34,139,34

    fuchsia #ff00ff 255,0,255

    gainsboro #dcdcdc 220,220,220

    ghostwhite #f8f8ff 248,248,255

    gold #ffd700 255,215,0

    goldenrod #daa520 218,165,32

    gray #808080 128,128,128

    green #008000 0,128,0

    greenyellow #adff2f 173,255,47

    grey #808080 128,128,128

    honeydew #f0fff0 240,255,240

    hotpink #ff69b4 255,105,180

    indianred #cd5c5c 205,92,92

    indigo #4b0082 75,0,130

    ivory #fffff0 255,255,240

    khaki #f0e68c 240,230,140

    lavender #e6e6fa 230,230,250

    lavenderblush #fff0f5 255,240,245

    lawngreen #7cfc00 124,252,0

    lemonchiffon #fffacd 255,250,205

    lightblue #add8e6 173,216,230

    lightcoral #f08080 240,128,128

    lightcyan #e0ffff 224,255,255

    lightgoldenrodyellow #fafad2 250,250,210

    lightgray #d3d3d3 211,211,211

    lightgreen #90ee90 144,238,144

    lightgrey #d3d3d3 211,211,211

    lightpink #ffb6c1 255,182,193

    lightsalmon #ffa07a 255,160,122

    lightseagreen #20b2aa 32,178,170

    lightskyblue #87cefa 135,206,250

    lightslategray #778899 119,136,153

    lightslategrey #778899 119,136,153

    lightsteelblue #b0c4de 176,196,222

    lightyellow #ffffe0 255,255,224

    lime #00ff00 0,255,0

    limegreen #32cd32 50,205,50

    linen #faf0e6 250,240,230

    magenta #ff00ff 255,0,255

    maroon #800000 128,0,0

    mediumaquamarine #66cdaa 102,205,170

    mediumblue #0000cd 0,0,205

    mediumorchid #ba55d3 186,85,211

    mediumpurple #9370db 147,112,219

    mediumseagreen #3cb371 60,179,113

    mediumslateblue #7b68ee 123,104,238

    mediumspringgreen #00fa9a 0,250,154

    mediumturquoise #48d1cc 72,209,204

    mediumvioletred #c71585 199,21,133

    midnightblue #191970 25,25,112

    mintcream #f5fffa 245,255,250

    mistyrose #ffe4e1 255,228,225

    moccasin #ffe4b5 255,228,181

    navajowhite #ffdead 255,222,173

    navy #000080 0,0,128

    oldlace #fdf5e6 253,245,230

    olive #808000 128,128,0

    olivedrab #6b8e23 107,142,35

    orange #ffa500 255,165,0

    orangered #ff4500 255,69,0

    orchid #da70d6 218,112,214

    palegoldenrod #eee8aa 238,232,170

    palegreen #98fb98 152,251,152

    paleturquoise #afeeee 175,238,238

    palevioletred #db7093 219,112,147

    papayawhip #ffefd5 255,239,213

    peachpuff #ffdab9 255,218,185

    peru #cd853f 205,133,63

    pink #ffc0cb 255,192,203

    plum #dda0dd 221,160,221

    powderblue #b0e0e6 176,224,230

    purple #800080 128,0,128

    red #ff0000 255,0,0

    rosybrown #bc8f8f 188,143,143

    royalblue #4169e1 65,105,225

    saddlebrown #8b4513 139,69,19

    salmon #fa8072 250,128,114

    sandybrown #f4a460 244,164,96

    seagreen #2e8b57 46,139,87

    seashell #fff5ee 255,245,238

    sienna #a0522d 160,82,45

    silver #c0c0c0 192,192,192

    skyblue #87ceeb 135,206,235

    slateblue #6a5acd 106,90,205

    slategray #708090 112,128,144

    slategrey #708090 112,128,144

    snow #fffafa 255,250,250

    springgreen #00ff7f 0,255,127

    steelblue #4682b4 70,130,180

    tan #d2b48c 210,180,140

    teal #008080 0,128,128

    thistle #d8bfd8 216,191,216

    tomato #ff6347 255,99,71

    turquoise #40e0d0 64,224,208

    violet #ee82ee 238,130,238

    wheat #f5deb3 245,222,179

    white #ffffff 255,255,255

    whitesmoke #f5f5f5 245,245,245

    yellow #ffff00 255,255,0

    yellowgreen #9acd32 154,205,50

Change the Color of the Background

CSS Code View

Live Demo


Font Properties

Basic properties that style the font. Children inherit these properties from parents.

CSS Code View

Live Demo

Font Style Properties

More stylistic properties to change the appearance of fonts.

CSS Code View

Live Demo

Font Style Properties


Text Layout Properties

These properties have to do with the inline flow of the characters. The children inherit all of these properties from their parents. I have created three selectors, one for the header h3., one for the body text p and one for the superscript inside the body text.

CSS Code View

Live Demo

Text Layout Properties

Change the text by applying different styles. Notice that when you make a mistake, the style reverts to the default style. The 1st selector is an h3. The 2nd selector is a p. The 3rd selector is a span acting like a superior (sup) tag and the 4th selector selects an actual sup tag and colors it red.


Box Properties

box model

Each HTML element is a box. The size of this box is determined by its inheritance, the content, or by a CSS rule. By default, the width of the box is inherited from the parent and the height is determined by the content. That makes the box is as wide as its parent, or the width of the window when the parent element is the body tag.

The box remains invisible unless it has a border or a background.

The box has four sides. You can target each side’s margin, border and padding at once padding: 10px; the vertical and horizontal sides separately padding: 0 auto or each side independently, starting at the top and moving clockwise: top, right, bottom and left padding: 0px 30px 60px 90px;.

CSS Code View

Each element is a box. The size of the box is determined by the parent element, or if CSS is used, the box can have a width, height, padding, border and margins. Padding and the border is added to the size of the content.


Border Properties

The border usually uses a shorthand where the width, color and style are given in this order: border: 10px solid #f68;. Leaving any one of these out breaks the border. Here is a list of the styles:

none: No border. Color and width are ignored (i.e., the border has width 0 unless the border is an image.
hidden: Same as none but has different behavior in the border conflict resolution rules for border-collapsed tables.
dotted A series of round (square?) dots.
dashed: A series of square-ended dashes.
solid: A single line segment.
double: Two parallel solid lines with some space between them.
groove: Looks as if it were carved in the canvas.
ridge: Looks as if it were coming out of the canvas.
inset: Looks as if the content on the inside of the border is sunken into the canvas.
outset: Looks as if the content on the inside of the border is coming out of the canvas.

CSS Code View

Live Demo

You can change the border attributes including the style yourself.


Thematic Break

The Thematic Break, also knows as the horizontal rule in previous version of HTML has the following CSS for the default style. You can change that.

CSS Code View

Live Demo



Margin and Padding Properties

These properties belong to the box model, and are similar, in that they create or subtract space from the sides of the box. I created two elements to show how border collapse works when two margins overlap and only the largest margin is used.

CSS Code View

Live Demo

BOX 1: The margin is set for 20px auto, meaning that the box has 20 pixels of margin on top and bottom, and the left and right margins are automatically adjusted to center the box, possible only because the box has a declared width

BOX 2: Notice that even though both boxes have a 20px margin, that margin collapses between the boxes. If you play around with the numbers, you will see that it collapses the smaller margin into the larger margin.


List Properties

Lists are used for any element that acts like a list. Many elements are styled as lists, and when that happens, its important to take control over the list element, so that the items styled take on the look that does not necessarily look like a list. Menus are a great example of this but many other items are also considered candidates for being styled as lists. If the list-item-style is turned to one of the automatically incrementing counters, the un-ordered list is automatically turned into an ordered list.

CSS Code View

Live Demo

  • List Item
  • List Item
    • List Item
    • List Item
    • List Item

The HTML for the unordered list

<ul>
<li> List Item </li>
<li> List Item </li>
	<ul>
		<li> List Item </li>
		<li> List Item </li>
		<li> List Item </li>
	</ul>
</li>
</ul>

Live Demo

Have numbers span ordered lists by using the attribute start="3" or 55 or 77

  1. List Item
  2. List Item
  1. List Item
  2. List Item
  1. List Item
  2. List Item
  1. List Item
  2. List Item

You can style the bullets of the list with gradients As Eric Meyer demonstrates.

CSS Code View

Live Demo

  • This is a list item.
  • So is this.
  • The list is unordered.
  1. This is a list item.
  2. So is this.
  3. The list is ordered.
  1. This is a list item.
  2. So is this.
  3. The list is ordered.


Tables

Tables used as tables are part of the HTML/CSS landscape. Tables used for layout purposes are to be banished. That said, if you want to style a table, its best to create as many hooks in it as possible. This means that a table can have table header, a table footer and multiple table bodies. It is also possible to style columns. The code and an explanation of how the table works is reproduced below:

CSS Code View

The Caption Holds the Title of the Table
Head 1 Head 2 Head 3
table cell item table cell item table cell item
table cell item table cell item table cell item
table cell item table cell item table cell item
table cell item table cell item table cell item
table cell item table cell item table cell item
table cell item table cell item table cell item
table cell item table cell item table cell item
table cell item table cell item table cell item
The Footer is a Place for Information About the Table.
<table id="table">
 <caption>The Caption Holds the Title of the Table
 </caption>
 <col><col><col>
 <thead> 
  <tr><th>Head 1</th><th>Head 2</th><th>Head 3</th></tr>
 </thead>
 <tbody>
  <tr> <td> table cell item </td>  <td> table cell item </td>  <td> table cell item </td></tr>
  <tr> <td> table cell item </td>  <td> table cell item </td>  <td> table cell item </td></tr>
  <tr> <td> table cell item </td>  <td> table cell item </td>  <td> table cell item </td></tr>
  <tr> <td> table cell item </td> <td> table cell item </td> <td> table cell item </td></tr>
 </tbody>
 <tbody>
  <tr> <td> table cell item </td>  <td> table cell item </td>  <td> table cell item </td></tr>
  <tr> <td> table cell item </td>  <td> table cell item </td>  <td> table cell item </td></tr>
  <tr> <td> table cell item </td>  <td> table cell item </td>  <td> table cell item </td></tr>
  <tr> <td> table cell item </td> <td> table cell item </td> <td> table cell item </td></tr>
 </tbody>
 <tfoot>
 <tr><td colspan="3">
	The Footer is a Place for Information About the Table.
  </td></tr>
 </tfoot>
</table>

The HTML code for the table can be divided into parts, and each can be styled separately. There are table headings, footers, data cells and captions and rows, all of which can be styled. The even and odd table rows are styled using pseudo selectors. If you look at the code, you can see that the table caption comes first, then the table header, two table bodies that contain the table rows and the table data cells and finally a table footer. The row tags allow the three rows to be styled individually, though that too could be handled by pseudo selectors.


Pseudo Classes

Pseudo classes are additional classes that belong to the same element. They are most frequently applied to the link element for navigation, where hover and click or visited states can be applied to that link, though any element can have hover states applied:

CSS Code View


Pseudo Classes: not

A collapsable guide to the layout modes. All of the work is being done by the last CSS rule using the pseudo class not, as in not target or hover li:not(:target):not(:hover) .

CSS Code View

Live Demo

Here you will find links to the layout modes article, including the document flow, the positioning of the elements within the document flow and display, z-index and overflow properties.

HTML

  <nav>
    <ul>
      <li id="nav-about"><a href="#nav-about">Layout Modes</a>
        <ul>
          <li><a href="#layoutModes" target="_blank">Layout Modes</a>
          <li><a href="#block" target="_blank">Block Display</a>
          <li><a href="#inline" target="_blank">Inline Display</a>
        </ul>
      <li id="nav-projects"><a href="#nav-projects">Positioning</a>
        <ul>
          <li><a href="#positioning" target="_blank">Normal</a>
          <li><a href="#relative" target="_blank">Relative</a>
          <li><a href="#absolute" target="_blank">Absolute</a>
          <li><a href="#fixed" target="_blank">Fixed</a>
          <li><a href="#floats" target="_blank">Floats</a> 
          <li><a href="#tables" target="_blank">Tables</a>
        </ul>
      <li id="nav-interact"><a href="#nav-interact">Other</a>
        <ul>
          <li><a href="#display" target="_blank">Display</a>
          <li><a href="#zindex" target="_blank">Z Index</a>
          <li><a href="#over-flow" target="_blank">Overflow</a>
        </ul>
    </ul>
  </nav>
  <div>
   Here you will find links to the <a href="http://b.parsons.edu/~dejongo/04-the-layout-modes" target="_blank">layout modes</a> article, including the document flow, the positioning of the elements within the document flow and display, z-index and overflow properties. 
  </div>
</div>


Pseudo Elements

Pseudo classes add elements to existing elements, in CSS rather than in the document. They can be first letter and line in an inline element and the before and after a block element.

CSS Code View

Live Demo

Pseudo Elements

A pseudo element I use often is the first-line pseudo element.

But other pseudo elements, particularly the before and after, are powerful, as you can see in this posted notes look complete with a page curl above right, created by the before element on the div above, without additional elements in the HTML. Quotes as in <q>quotation marks</q>can be given quotation marks using the before and after pseudo elements.

See more such wizardry in the creation of 84 icons, using nothing but such CSS tricks.

The trick with the folded corner is a really thick border that surrounds the empty content between the quotes of the css content property. The corners of the border meet at a 45° angle, and when the content is nothing, all four corners meet at the middle in a sharp point. Put two such corners together and you get the triangle used to shape the page curl. All you have to do is fill those two sides with the color of the page curl, and fill the other two sides with the background color to block out the corner of the note, which would otherwise stick out.

Cursor

Give the user feedback. Changing the cursor is an instruction away. Roll over the square to see the change.

CSS Code View

Live Demo

Roll the cursor over this square to see it change to a little hand with a pointing finger cursor. Change the cursor in the CSS view to check out all of the cursors.

So much more

30 Seconds if CSS. Ready made CSS snippets to help you build your website.

01 Intro to the Web

Clicking on the introductory text brings you down to the materials section.

Welcome to Web Design Basics

 

CSS is in the middle of changes that will eventually require me to adjust the way I teach the course. The changes have not yet settled down as I wait for best practices to become clear. In addition, artificial intelligence is changing the landscape, providing editorial, image, and design solutions and code to students where there had been none. It will take a while before the dust has settled. In the meantime, I’ve accumulated a lot of material through the years, so changing the course is easier said than done. I’ve integrated some of the new topics along with making sure that the old ways remain available. Extra credit to anyone giving me useful feedback on improving the website.

Collaborate, be compassionate, and creative!

Tim Berners-Lee, the person who founded the World Wide Web, posted an open letter on the web’s 35’s birthday (March 23, 2024) discussing the state of the web, affirming his original intention, the three Cs: the intention for collaboration, to foster compassion, and generate creativity, and criticizing its commercialization and monopolization. That is what the web is about. This is your community. Collaborate, be compassionate, and creative!

What do you hope to achieve this semester?

Write a few sentences expressing what you hope to achieve this semester, if you haven’t already done so in class. You should do this first thing before you read or hear how I will proceed. This will provide me with insight into what you expect, and will provide you with an indicator of your original expectations. You will post this on the landing page you will create next week.

Inspiration

Building a website opens you up to your target audience. Exposure to what you perceive to be your target audience is the biggest benefit of this course. Capitalize on that opportunity! It is not learning how to build websites, which is easy enough, and gotten easier with AI, but to use that knowledge to discover, target, and convert your target audience: to sell yourself. Use this course to position yourself within your professional horizon. It is an opportunity to organize, test out, innovate, secure and professionally develop yourself. The future will be shaped by AI. What is AI? AI will only become more ubiquitous, so you might as well get to know it. I expect you to use AI to help you confront AI, and to come out on top.

Let’s say your major is product design. When the instructor asks you to come up with a product idea, those ideas most likely originate out of your own interests, of what you want to do, or out of what you think your teacher requests. But by building a website to sell that project, you start thinking about the target audience. Who is the product for? How will they use it. How are similar products marketed? What can I learn from the competition? Do the research. Check out other websites. As the competition is established, they probably know a thing or two about how to reach their customers. This is the market you have to enter.

Working to define your target audience, figuring out how to best capture their attention, and selling your product will impact how you communicate whatever commercial art you are working on here at Parsons. Being attentive to the real world and targeting your work is the best way to initiate any product. Doing so will make you more competitive. A marketing strategy for your product will force you to create a more thorough and complete job from the outset.

The course demands you to think about your target audience. Who will use your website? Who are you building it for? This is an opportunity to think about, investigate, and target your work. Whatever your major: photography, illustration, fashion design, etc, your work will improve when you take your target audience into consideration. Building a website around that goal can only reinforce your concentration as to who your target audience is. Haven’t thought about it much? This is a commercial design school. You are being educated to solve the problems that other people want solved. You need to be clear as to what the problems are, so you can solve them. A website gets you into that space, so you can test things out.

What do I hope you achieve this semester?

I hope that this course will prime you to always consider your target audience for all your creative commercial work while at Parsons and beyond. Nothing keeps you from developing a website and marketing materials for whatever projects you will create from here on out.

I recently ran into the son of a friend of mine who picked up a new girlfriend who recently graduated from the fashion design program at Parsons. She did develop a generic website, using SquareSpace or Wix, I’ve forgotten. She did not investigate her target audience until the very last year, and was not prepared to market her work until the last moment. After telling her about this course, she wished she had taken something like this early on in her student career, so she could have been up and running by the time she graduated rather than figuring out how to do that after the fact. This course is about developing who you are and your professional career. Think of it as an opportunity and treat it that way. The real grade for this course is earned by who you become, not whatever letter grade on a transcript that few will ever take note of.

Grades

There are 20 assignments I use to grade your progress, but the main deciding factor is the progress you exhibit between the midterm assignments and the final. I expect professional looking, validated websites that take user experience into account. I provide feedback on your work throughout the semester, and grade everything at the end of the course, which allows for revisions to earlier or incomplete work without penalty. If you have any questions as to your standing in the course, please ask me. 

Everyone will not have had the same exposure to the plastic language of art, design, and graphic problem solving, and just because you can illustrate, in my experience, is no indication that your graphic design sense is any good. To help amend any visual literacy deficiencies, there is supplementary information and the vignelli Canon) to help everyone achieve visual literacy. My grade will not reflect the talents you do not bring to this class. I evaluate each person on their own terms, and do not compare students according to their fluency in design, etc. Seek help and advice from me or your peers, not only to solve problems in your code, but for visual and design issues as well.

Learning how to Code

Learning to code requires internalizing the rules and methods associated with HTML and CSS. You learn by coding. Internalize HTML and CSS by creating websites. Be ready to explore how to code. The World Wide Web is the teacher that has every answer. Effective web searches are a great way to understand the problems that you encounter.

Start with the basics and try it yourself. Take the initiative and build websites. The magic word is repetition. Your ability to problem solve with code improves with each website you build. The more websites you build, the better you become.

Chat GPT and an increasing number of AI competitors are available to help you code, create pictures, write copy, etc. Get to know them and take advantage of these resources. But first you have to be familiar with the basics of HTML and CSS, or you will have difficulty integrating the code they produce. I want you to use AI to help create websites that go beyond what you can code on your own. Your websites need to stand out, to be different from other websites, to reflect who you really are, and catch the attention you deserve. To need to learn how to hand code to make that unique and special website.

There are other ways to expedite the creation of a website, like using Twitter’s Bootstrap to realize your site. But you still need to have the basics down to take advantage of Bootstrap, and it takes time to learn Bootstrap that is not spent learning HTML and CSS. Though Bootstrap websites are professional, you cannot generate a totally unique site the way you can by hardcoding it.

Other programs don’t require that you know any HTML or CSS, and provide an InDesign-like interface experience. I’ve had students use Webflow, for example, and the websites looked professional, but do not necessarily stand out. The time it takes to learn such a program is better spent learning how to code. It provides you with more flexibility in the end, to create something that stands out.

I haven’t used Adobe Dreamweaver in a long time, but I’ve used it at an ad company many years ago. They did not use the ‘what you see is what you get’ design interface, only as a development platform, because of its tight integration with the other adobe apps that the rest of the creatives used. I don’t know if Dreamweaver is still in use, but you are better off using your time to learn to code by hand.

Plagiarism

You are free to use any and all artificial intelligence and other web and code services to create your work. You can beg, borrow, and steal, just let me in on it, and be able to defend it, if I ask questions. By that I mean that you understand what the code is and what it is doing. The one requirement, if you use outside help, that you document where your code comes from. I will consider it plagiarism if you don’t, which can result in a) failure of the assignment or b) failure of the course, with multiple instances leading to possible suspension or even being expelled from the school. This is from the The New School Academic Honesty And Integrity Policy, so don’t pass off as yours what someone else created.

Document everything that you have not directly created and let me know what services you have used, etc. There is a place in the landing page for you to do that. Most every service can be traced back in the structure of the code, but I prefer to know ahead of time where everything came from, rather than having to figure it out. That makes it easier for me to evaluate you on the basis of the code you write, and not the code you did not write.

Course Design

You only learn to code by doing it. My aim is to get everyone coding by the midterm, so you can practice coding on your own projects for the rest of the semester, with the strategy that you grow secure in your ability to code by the time you leave this course. I front-load the course. That means the first half of the course is demanding and requires you to keep up with the work. I ease up in the second half of the course, to give you the freedom to apply what you have learned on your own projects, or to catch up if they did not fully finish everything by the midterm. This format works for most students. Some students wish I would continue to provide guidance in the second half of the semester. I may figure out additional projects, but if I don’t, and if you are one of those students, ask me, and I’ll be happy to assign additional guidance, projects, and whatever it takes to keep you engaged. 

Seniors can choose to spend the entire course developing their portfolio or senior projects (instead of the final assignment, where everyone else has to sell something other than themselves.) I recommend you to sell something other than yourselves, as that allows for a more effective application of your creative talents. By completing the course successfully, you should be able to build a better portfolio website in short order. You’ll learn more when you’re not stuck on the same project for the entire 15 weeks, and portfolio websites are rarely complicated enough to warrant the extra time. But I understand the pressure to build out and perfect one’s portfolio site, so the option is there.

Easy access to artificial intelligence (AI) transforms this course, since it is possible to get the chat bots to write code for you. But to take advantage of that, you need to understand how to code, to integrate what it produces. While there are no restrictions of the use of chat bots to create code for you, you are to attribute where the code came from whenever you do not write the code yourself, be it from a website, or if a chatbot helped you write the code. This can be done using the comment element.

Why learn how to code websites by hand for the web? There are many website builders that allow a person without much prior knowledge to create a good-looking website without hand coding HTML or CSS. The tradeoff is that these web experiences use templates, making it more difficult to differentiate yourself from other web experiences. In today’s competitive world, to stand out in a captivating way is a plus. 

You should be able to follow me in class and glean most everything you need to learn how to code. If not, the course portal has your back.
 

This website is here to help you. Use this portal to help you catch up when you’ve missed a class or need a reminder later on. All the lectures are written out. If you have trouble with a topic as presented in class, read the topic on the website, and follow the links and examples. 

Make up the material of a missed class before the next class. Students entering the course after the first or second lectures need to read all the material as soon as possible and complete all assignments to catch up with the rest of the class. 

Much of the learning takes place as you write code. Learning to build websites is a cumulative effort: basic skills are necessary for building advanced skills. Watching me write code is not the same as writing code yourself. You start learning when you try to overcome the mistakes you have made. Don’t be intimidated. Start simple and you will become more adventurous as you gain confidence. Most of you will be wondering what all the fuss was all about by the time the midterm arrives. 

The scope of this course is coding HTML and CSS with a smidgin of PHP and JavaScript thrown in. A student needs a solid foundation in designing and developing HTML and CSS before they deploy JavaScript to develop behaviors. That makes it optional. Anyone can use existing JavaScript code, and if you already know the language, don’t let me stop you.

If you missed a class or do not completely understand a topic well enough to move on, go back to the supporting material. If you have difficulties understanding the material or completing your homework, email me or visit the Learning Center. I recently found out that the department has students available for you to ask questions at the Design Lab located on 10th Floor of 2 W 13th Street. Just go in and there should be people there to help you with your code. This may be better help than the university learning center.

In-Class Code Checking

Class Assignments require me to personally check your code in class for correctness. Many of you have laptop screens and display the code in small type, or reverse the color. While I want you to set your preferences that work best for you, these issues make it difficult for me to find that needle in a haystack, which is what it is like to discover errors in existing code. To facilitate my correcting your work, please increase the size of the code so I can easily see it, use black text on a white background, and move your laptop to the side, so I can sit directly behind it. The corrective glasses I wear operate optimally at a specific distance two or so feet from the screen.

I mention this because it is possible that I encroach on your personal space as I situate myself to read your code, and I would prefer not doing that. This is especially important if you are sensitive about your space. Some people are more sensitive than others. I work to be respectful of everyone, knowing that there are many personal and cultural differences at play. Please make sure I can view your code in a way that is both comfortable for me and for you.

Do not hesitate to ask or email me if you have questions.

I am always surprised by the number of students who do not ask me for help when they are having problems. You can always ask me. Email me, and if I can’t answer the question over email, we can schedule a zoom meeting to figure out what the story is. Remaining silent when I ask, if anyone has any questions, communicates to me that you understand what the story is, and that you have no questions. Speak up if that is not the case. If you do not like to speak up, email me.

Most answers can be found in this website, or on the web. Write full sentences in Google Search to ask your question, as in “how do I create a link in HTML.” Or just ask a chatbot. If you can’t figure out the problem on your own, ask me. There is so much information that it’s not always easy to connect it all with what you need at that moment. So you get stuck. Know that most of the mistakes happen in the first four weeks of the course. Use validator with some frequency to catch any issues as you code. Sometimes in CSS the mistake happens right before the css code that does not work. By the midterm, the mistakes will mostly disappear.

Do a through job on the first assignment and the worksheet. The writing you complete provides the repetition necessary to make marking up content second nature, and that makes coding web pages a lot easier. I’ve had students who skimped and the result was they did not internalize marking up the content, and without that foundation, their progress was slow, and coding remained difficult.

Book time at the Learning Center. How to make an appointment. and schedule an appointment.. They can help you understand and overcome the problems you are facing, help you code your final project, and keep you organized and working. Or check out the Design Lab located on 10th Floor of 2 W 13th Street. Just go in and there are people there help you with your code.

There are many resources on the web from which to learn how to code. Do make sure that the information is current or you will be learning ways that are no longer practiced. A comprehensive resource is Mozilla’s Mozilla developer network (MDN) which includes individualizedAI Help. Also look into Google’s Chrome Developer Relations web.dev. The important thing is that you practice writing code and to do it often. The only way to learn to write code is by writing code. Making mistakes is part of the process. The mistakes that stop you dead in your tracks disappear after a week or two of doing the work. Do not become discouraged when you get stuck. There are many ways to solve most problems. Take a step back and try again. Use validator to help you avoid mistakes. 

And what if you do not like my teaching style or this website?

There are people who cover the basics from the beginning. CSS Tricks is Chris Coyer’s website and a great resource for all things for building websites. His Where do you learn HTML & CSS is 2020 is a great place to start. But many people attempt to communicate the basics, like How to Build a Website with HTML to help you learn the basics. I googled that and there is so much more so finding alternatives to me is easy enough.

The real grade for the course

The grade that goes on your transcript is not as important as learning the basics of web design well. You could gain a career out of front-end web development, as previous students have. You are planning to enter the workforce, a good website can only help. Whatever you want to do with your life is at stake. Work as if that is the case, and your grades will be fine. Everyone is different. Not everyone needs to sell their creativity on the open marketplace. I will be grading you on your work, and will not be comparing you to others in the course. I look to see how much each person improved from the first assignments to the last. It is easy to see the effort in your projects, and effort counts.

Getting Help:

  1. Ask questions during the lectures and code demonstrations in-class.
  2. Read and watch videos on the website.
  3. Do the homework.
  4. Validate your work often. This will keep you from making mistakes.
  5. Email me whenever you have questions.
  6. Search the web for solutions. Type the solution you’re looking for in complete sentences.
  7. Visit the Design Lab located on 10th Floor of 2 W 13th Street. Just go in and there should be people there to help you with your code.
  8. ask a chat-bot for help, or to solve the problem for you.
  9. Visit the Learning Center. They will help you with your homework. Slots are limited, so sign up in advance.
  10. Watch Lynda.com video instruction. 
  11. Book is optional. It is ancient and I don’t refer to it in the course. HTML5 & CSS3 Visual QuickStart Guide (8th Edition). Some students like to read a book, and if you are one of those students, please use this or any other HTML/CSS book to do so. 

About this Website

 

I present each class systematically. Figuring out the topic, the information you need, the homework, and support files, is straightforward. Otherwise, you can use the search bar at the top of the window to find what you are looking for.

The fixed menu on the right-hand side covers every class, in addition to often used reference websites. Clicking on the link loads the class page. I structure each page in the same way, except this one, as it has welcome information. 

A shortcut to each class, the associated pages, and to the homework is available on the top menu.


Week 1
8/28

Introductions. Overview of course, course objectives, outcomes and expectations. Go over syllabus. Introduce hypertext markup language. Activity: Analyze Website. Activity: Create HTML file, start first assignment in class.

Homework

Write out expectations for the course. Use OpenAI to interrogate your future plans. Read Why Do All Websites Look the Same? Watch introductory videos. Analyze the elements of a website. Create a content sheet for the main page of a site that epitomizes the design field you are in. Write down the goals of the site. Use images. Mark up the assignment.. Due: Next Week. Email me if you have questions.


Next up are the goals and outcomes of this course. This is what you are to learn.

Much of the learning is scaffolded, meaning that what you learn is a necessary part of a larger skill set that you need to be familiar with. These learning outcomes need to be acquired before the next class meets, as it likely assumes this knowledge and builds upon it. If you miss a class, you are responsible for making up the class you missed by going over all of the information.


Goals

The goals of this unit are to:

  • Introduction to the World Wide Web.
  • Understand the content strategy that goes into creating websites.
  • Learn how to mark up content.
  • Set up a server at Parsons/New School using Fetch.
  • Start first assignment page on the web.

Outcomes

At the end of this unit, students will:

  • Be familiar with the web and the code that generates web pages.
  • Understand the elements that make websites work.
  • Learn basics of HTML and CSS.
  • Mark up a simple page.
  • Set up server space at b.parsons.edu.
  • Publish a page on the web.

    If the class did not cover all of these topics, relax. They will be covered next week.


The topic summary and homework assignment are followed by a materials section that has all of the linked files associated with the course.

Green and red colored links are required reading.

Green signifies conceptual overview that helps put the material in perspective.

Red signifies core knowledge that you need to know to continue. That means you should reread the material if you do not understand, or read the corresponding chapters in the book.

Links without color are suggested readings, but not required.

The homework link takes you to the homework for the week.


Additional material for this unit can be found by following the following links:


The estimated breakdown of time it should take for each topic to be adequately covered in class. Some topics are summarized in a few minutes. Others are demonstrated at length. Emphasis is on those topics that help you master the skills needed to build web pages, which are usually done through in-class activities. What is said and done in class overrides what is written here.


Step-by-Step

15 Welcome, write a few sentences about your expectations for the course as we go through the introductions, and go through the syllabus
5 Overview of the course and class portal.
25 Exploration of the web. Peek behind web page to look at the code.
15 Activity: Create content by writing.
10 Break
30 Demo/Activity: Marking up the content. Writing HTML
15 Tools of the Trade
15 Get server space set up.
5 Go over Homework assignment
10 Q&A

Learn By Doing

Paying attention in class is half the battle. Putting into practice what’s covered in class is the other half. Each class teaches a necessary skill. It is your responsibility to learn it. 

  • Code a little each day, not a lot once in a while. You’ll get over the frustration soon enough. Coding web pages is not so difficult once you get over the minor mistakes that everyone makes when they start. 
  • There are two major assignments: a midterm portfolio and a professional, standards compliant, website that sells a product for the final.
  • Validate!

           

    Why validate?

    The core reason to run your HTML documents through a conformance checker is simple: To catch unintended mistakes—mistakes you might have otherwise missed—so that you can fix them.

    Validate your work often! The validator is your friend that will point out your mistakes.

    There are alternatives, like Validator.nu, an alternate address for CSS validator, and direct CSS input.

    Go beyond validation by measuring your page quality using web.dev’s web page audit. It will measure your performance, accessibility, best practices, and Search Optimization, give you hints on how to fix it, and teach you how to do it better as well.

    Do not be alarmed if there are 50 mistakes. That can happen if you haven’t been using the validator as you should. One mistake can flag a lot of other issues. Fixing one problem can make other problems disappear.


    Many of the units point to a number of websites that exemplify current practices. This helps you see how the web implements the topics discussed in class.

    Current Practices

    A lot of websites deserve to be looked at as standard bearers for the web. A few that have stood the test of time:

    • CSS Zen Garden Original CSS experiment in 2003 that explores what is possible using CSS and galvanized the web toward standards compliant websites.
    • The Rijks Museum opened the floodgates for the new single page jQuery web design experience. Others had come before but it pushed behaviors over the top. The user experience and content interaction are impeccable.
    • NY Times The New York Times soon followed. A standard setting newspaper that helped move the web away from its addiction to tables in 2007 has just been redesigned using jQuery animation. Follow the link to see how design considerations led to a more engaging web experience.
    • The New School Jumped onboard with the JQuery look in 2014 as well. It’s redesigned the website several times since then. The Parsons Web Site.
    • Apple helped define design as the central tenet of computer usage and did so against the establishment for many years. Now it is the establishment. Its website is has remained similar for many years. It is sparse, to focus on what is important while hiding a site of vast complexity.
    • Facebook Not for what it looks like but for having taken over such a big part of the web. It has walled off a large section of the web and privatized the experience. The privacy is good for users, who feel free to share their experiences with friends and family. Except there is a back door. Facebook shares details with corporations to target advertising and government spy agencies. That’s not all they collect, so watch out what you say or do. That’s the price of freedom, or so they say.
    • The Bulletin of Atomic Scientists: How a nuclear war would kill you — and almost everyone else.
      In a nuclear war, hundreds to thousands of detonations would occur within minutes, resulting in tens to hundreds of millions of people dead or injured in a few days. But a few years after, global climatic changes caused by the many nuclear explosions could be responsible for the death of more than half of the human population on Earth. Good use of multimedia and paralax effect to tell the story.
    • The Armed Conflict Location & Event Data Project exemplifies information design.

    There is nothing like examples to motivate your own work. Be motivated to do your best. You are the one who gains from learning these skills. I’ve had students, like Urara Ito, who entered the industry after taking the class.


    The last item on the first few pages contains definitions for words used in the class that you should be familiar with.

    Definitions

    These are the terms that participants should be familiar with during this unit:

    The W3 organization definitions of HTML, XHTML and CSS:

    HTML (the Hypertext Markup Language) and CSS (Cascading Style Sheets) are two of the core technologies for building Webpages. HTML provides the structure of the page, CSS the(visual and aural) layout, for a variety of devices. Along with graphics and scripting, HTML and CSS are the basis of building Web pages and WebApplications.

    What is HTML?

    HTML is the language for describing the structure of Web pages. HTML gives authors the means to:

    • Publish online documents with headings, text, tables, lists, photos, etc.
    • Retrieve online information via hypertext links, at the click of a button.
    • Design forms for conducting transactions with remote services, for use in searching for information, making reservations, ordering products, etc.
    • Include spread-sheets, video clips, sound clips, and other applications directly in their documents.
    With HTML, authors describe the structure of pages using markup. The elements of the language label pieces of content such as “paragraph,” “list,” “table,” and so on.

    What is CSS?

    CSS is the language for describing the presentation of Web pages, including colors, layout, and fonts. It allows to adapt the presentation to different types of devices, such as large screens, small screens, or printers. CSS is independent of HTML and can be used with any XML-based markup language. The separation of HTML from CSS makes it easier to maintain sites, share style sheets across pages, and tailor pages to different environments. This is referred to as the separation of structure (or:content) from presentation.

    HTTP

    The Hypertext Transfer Protocol (HTTP) is a networking protocol for distributed, collaborative, hypermedia information systems.[1] HTTP is the foundation of data communication for the World Wide Web.

    FTP

    File Transfer Protocol (FTP) is a standard network protocol used to copy a file from one host to another over a TCP-based network, such as the Internet.

    01 Tools of the Trade

    All that is needed to code for the web is a text editor. Everything we do is coded by hand. For learning how to code, it is best to write the code itself with a simple Text Editor so that the repetition helps you to remember. Once you know what you are doing, you can use amore advanced editors. No authoring programs like Adobe Dreamweaver or Muse.

    It’s our preference to use a text editor, like HomeSite, TextPad or TextMate, to “hand code” everything, rather than to use a wysiwyg what you see is what you get HTML and CSS authoring program, like Dreamweaver. We just find it yields better and faster results.

    Khoi Vinh, Design Director at NYTimes.com from NY Times Article

    Text Editor

    The text editor, the browser and FTP program are all you need to build web sites. Do not use Microsoft Word or another word processor. There are many text editors. I prefer a simple HTML/CSS dedicated editor with live preview. Brackets is the most straightforward, simplest, and easiest editor with a built in preview. You can also use the Phoenix in browser editor (currently only works with the Chromium based browsers). Atom and BBEdit are other HTML centric editors.

    Other editors are for general programming, and target all kinds of programming languages. They are good but can be more confusing to use, like Microsoft’s Visual Studio and SublimeText.

    The Browser

    Any of the standards compliant browsers can be used. Chrome is most popular, Firefox is the best, and Safari plays nicest with the OSX operating system. Every other browser runs on the Chrome engine. In Safari, go into the Preferences -> Advanced tab and select Show Develop Menu in the menu bar to get the development goodies to show. All browsers allow you to inspect the code with the browser development tools. Right click, select Inspect, to zoom into the code that describes the document at the point where you click. If you have never done that before, please explore the code behind the websites you browse.

    HTTP

    Hypertext Transfer Protocol (HTTP) is a protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but can be used for other purposes. HTTP follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response.

    SFTP using Fetch or FileZilla

    Uploading your files to the server requires a Secure File Transport Protocol (SFTP). The application that does that for Mac users is Fetch. With it you can upload and download files onto your web space at school. Fetch was created at a university and is free to all students. You can get your free license here. Fill out the form, use the Parsons mailing address 66 5th Avenue, New York 10011, and they will send you a serial number to use with Fetch.

    FileZilla is a cross platform SFTP program for students using windows. Instructions for connecting and transferring files using Fetch and FileZilla are available near the bottom of the page. 

    Other SFTP programs available on both the Mac and Windows operating systems are CyberDuck, WinSCP, Fugu, and Transmit.

    Publishing Your Work using Fetch

    Everyone will publish their work on the web. We start by making sure that everyone can. The software most of you will use is Fetch. Don’t forget to register the product. It is free to all students.

    The server space is a lot like your desktop, only instead of folders, like on OSX, they are called directories. These servers are usually run by computers running Unix or Linux. These operating systems do not tolerate spaces. Lower case letters and capitalized letters (a and A) are not the same. Follow those rules to minimize problems uploading files to the web.

    You can drag and drop between the Finder window and Fetch. When you drag the same document into Fetch, the existing document will be overwritten without warning. This is default behavior. Always keep your latest version on your hard disk, where it can be backed up, rather than online, where you can accidentally over-write it.

    If you need more help, visit the Fetch help pages

    Setting Up Your Domain

    The domain is the name that you type in to get to the website. All websites are known by their number, but to make it easier for humans, they allow us to connect a domain name to that number. You can get you own, or by default, you will use the Parsons.edu domain.

    Everyone has server space at Parsons. The domain is hosted on the Parsons B Server. It looks like http://b.parsons.edu/~dejongo/. I have already created a page that has a link to the parsons folder I want you to set up. You can mask a domain name to that space. Alternatively, you purchase your own server space, you will need to register a domain name. Cost is approximately $15 a year for the domain name and renting server space ranges from $12 to $120 a year. Many hosting services include the cost of the domain name with the hosting plan.

    Setting Up Your Server Space at Parsons

    Art, Media, and Technology B.PARSONS.EDU user accounts are set up when I send a list of student names to the IT Department. They use the standard New School identification: last name with first initial and numbers that you are familiar with, prefaced by http://b.parsons.edu as your user account.

    You will be sent an email once the IT department has created your account. The email is from: root and the subject is something like: Important AMT B.PARSONS.EDU [user ID]. SAVE THIS E-MAIL!

    This email may have entered your spam folder, which can make it difficult to find. Please find the email and follow the instructions to set up your server space.

    The email will contain your B Server address, user, and password. You need to have your b.parsons.edu address and your B Server password to access your server space.

    If you have questions, or if it does not work, you should check to make sure address, name and password are typed in correctly. If it still does not work, enter a service request. Click on the link to Submit an IT Service Request at the top right of the page. Please have tickets assigned to Enterprise Systems group. Include your Last Name, First Name, Net ID, email and a request to ask about your server space on the b.parsons.edu server. You can also email the IT department to create a ticket.

    Getting your Own Host and Domain Name

    A lot of hosts give you a free domain if you subscribe. I personally use DreamHost, as they host non profit sites I work on for free. Their price is more expensive.

    One host I’ve run across is Ebound hosting, which has a great intro plan that costs only $1 a month. They also have an unlimited plan that gives you everything for under $5 a month including domain name for the year, multiple domains and all the usual goodies in spades. Their help response was quick and resolved all problems the one time I had to use them. Give them a try.

    Their cost, with a three year plan, is $4 a month, and that includes a lot of goodies, including a domain free for the first year. Search the web for a discount. There is a 25% discount using this code: EBH25 at the time I write this. I have no connection with Ebound hosting but in calling them to solve a problem, a real human answered on the second ring. That’s amazing these days.

    Finally, to get you started, you can host for free at biz.nf but their plans are more expensive over the long run than what you get with Ebound hosting. I’ve kept a number of domains for over 20 years, so the costs add up.

    Purchasing a Domain Name

    Registrars like name.com or Moniker, both of which I’ve used. there are a lot of accredited registrars

    You cannot point a domain to your New School or Parsons server space but you will be able to mask your domain to these accounts. That means a frame is created with your domain name above the address bar but it actually shows the school website, which appears in that frame.

    Connecting and Uploading Files to your Server Space

    To access your files using Fetch, fill out the Hostname with “b.parsons.edu” then fill out Username with your Newschool ID, set your connection to SFTP. Fill in your password. It can be found on the email from root. Set the port to “222” and your initial folder to “public_html”. You should be able to log on.

    how to fill out Fetch

    On Windows using FileZilla or on Macs that have trouble connecting to the server using Fetch from school or home, enter sftp://b.parsons.edu for Host, your username with your New School ID, the password as found on the email from root, and port: 222. That should work. In the left hand pane locate directories on your hard disk which contain the files to be transferred, and transfer them to the right pane representing your server space.

    how to fill out Filezilla

    You will be asked to confirm overwriting the file, which is the standard option. Check “Always us this action” and “Only apply to uploads”.

    how to fill out Filezilla

    The server is laid out much like your hard disk. You will drag files from the finder into Fetch, as if it were a local window. The main difference is that Fetch will not warn you when you are overwriting your files. This is a good thing, as you will be dragging your files from your desktop to the server and overwritten the old files with new files the whole semester long.

    The second difference is that upper and lower case letters are completely different, and have nothing to do with one another. On your hard disk, it makes no difference. On the server, your links will not work. My suggestion is to name all files using lower case. Do not use spaces in file names!

    On the parsons B Server, you need to place all your files in the public_html folder. Different hosts can designate different names for this folder.

    Setting up your Server Space

    I expect you to use your root — public — directory for your own purposes. The class works out of a folder called “parsons” with a lower case p. Case matters! Create a new folder and call it parsons lowercase p in the root directory. That is where you will develop all of your work for this class. As there is a midterm with associated assignments and a final, create two folders a portfolio and a final folder.

    Web Site Organization

    web site organization

    Index.html and Worksheet.

    You will create an index.html page inside of the parsons folder done in-class during the second week that will contain the links to each of your assignments, a photograph of yourself, along with your name and your major and minor, if you have one, so I can associate your work with you as a person.

    Your first assignment example counts as research for your portfolio. It could go in the portfolio folder or stand alone. A work-file inside of the portfolio example and final assignment folders example will serve as your worksheet. This is where you document your creative development in at least seven steps. Update these work-files with all of the work you do to get to your final. This includes old ideas even when you change your mind and start working anew. That way I can assign credit where credit is due.

    The landing page for each student needs to work exactly the same. This is how I make contact with your work. I will be going to this page to check up on your progress, so keep it current. Your grade depends upon it. Homework needs to be up the day before class — so I have some time to check it before teaching, for issues that can then be addressed in class.

    01 HTML5 Template

    Select all the text and paste into blank text editor document. Template 1 contains most used HTML5 elements. Template 2 does not. Text is at 25% so it can be easily copied. Make sure you copy all of the text.

    Template 1

    <!DOCTYPE html>
    <html lang="en"> 
    <head>
    <meta charset="utf-8">
    <title>title</title>
    <!-- Sets viewport to the device screen size -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!--Link an external style sheet-->
    <link href="css/styles.css" rel="stylesheet">
    <style> 
    	main { max-width: 1500px; }
    	section { max-width: 1000px; margin: 10px auto; padding: 0 20px; }
    	img {width: 100%}
    	figure {width: 25%; margin: auto;}
    /* Overrides desktop style when viewport is less than 600px (for smart phones) */
    @media only screen and (max-width: 600px) {
        
    }
    </style>
    </head>
    <!-- body -->
    <body>
    <main>
    <section>
    	<header>
    		<h1>Heading 1</h1>
    		<nav>		
    			<ul>
    				<li>
    					<a href="#">
    						navigation as unordered list item
    					</a>
    			</ul>		
    		</nav>	
    	</header>	
    	<article>
    		<h2>Heading 2</h2>
    		<p>The <strong>template</strong> contains <em>most used</em> HTML5 elements. Replace this text with the content written for the first assignment. Notice that there is no closing tag for this paragraph or for the list item in the navigation above.
    		<figure>
    			<img src="http://b.parsons.edu/~dejongo/12-fall/stuff/01-blocks.gif" alt="blocks" >
    			<figcaption>Blocks. The figure tag make adding a caption below the picture possible. The picture tag makes multiple pictures possible, and places the img, an inline element, in a block element. </figcaption>
    		</figure>
    	</article>	
    	<footer>
    		<hr>
    		<p>Resources
    		<ul>
    			<li> HTML <a href="http://b.parsons.edu/~dejongo/01-writing-html5/#inline_elements"  >inline</a> and <a href="http://b.parsons.edu/~dejongo/01-writing-html5/#block_elements"  >block</a> elements. 
    			<li> Writing <a href="http://b.parsons.edu/~dejongo/03-the-mechanics-of-css/" >CSS</a>, <a href="http://b.parsons.edu/~dejongo/03-applying-css/"  >examples</a>, <a href="http://b.parsons.edu/~dejongo/04-the-layout-modes/" >layout</a> and <a href="http://b.parsons.edu/~dejongo/05-styling-the-navigation/" > styling the navigation</a> 
    			<li><a href="https://validator.w3.org" >Validate your page</a>
    			<li><a href="https://web.dev/measure/" >Page quality audit</a>
    		</ul>
    	</footer>
    </section>
    </main>
    </body>	
    
    </html>
    

    Template 2

    <!DOCTYPE html>
    <html lang="en"> 
    <head>
    <meta charset="utf-8">
    <title>title</title>
    <!-- Sets viewport to the device screen size -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!--Link an external style sheet-->
    <link href="css/styles.css" rel="stylesheet">
    <style> 
    /* Overrides desktop style when viewport is less than 600px (for smart phones) */
    @media only screen and (max-width: 600px) {
        
    }
    </style>
    </head>
    <body>
    </body>	
    
    </html>
    

    01 Writing HTML5

    HTML stands for Hyper Text Markup Language. If you wish to see the entire specification in a one page version (large document), visit the living standard

    Content is “marked up” using tags to designate the structural significance of that content. Each piece of content so marked up constitute an HTML element, of which there are many.

    A first level header is designated by opening and closing tags: <h1> 01 Writing HTML5 </h1>. All parts of the document are marked up with such tags to create HTML elements, even parts that you cannot see but still describe the document, such as the meta tags found in the header, or the <style> and <script> tags that contain CSS and Javascript.

    To create an HTML page, open a text processor. Creating a new file and call it index.html when saving. The file needs to be called index.html with a lower “i”. It is the index of the directory in which it is located. It will be the file that is opened upon entering that directory.

    Every directory should have an index.html file, as some web servers allow visitors to see the content of the directory when there is no index.html file present. Other files in the directory can be reached by placing links connecting that page on the index.html page.

    The following elements make up the HTML page:

     

    The Structure of an HTML Document

     

    The Doctype

    The doctype has been greatly simplified in HTML5. The DOCTYPE tells the browser the version of the HTML rules the document will follow. Using the following DOCTYPE tells the browser you will be using HTML5. This is the only DOCTYPE I expect to see.

    <!DOCTYPE html>
    

    The HTML Element

    The HTML elements contains all other elements. It is the root element, and the language attribute is specified as English.

    <html lang="en">
    

    The Head Element

    The head element contains information about the content but not the content itself. This is known as the document;s metadata. The head element does not get displayed in the browser window.

    The Character encoding declaration specifies the encoding used to store or transmit the document. The Meta tag charset=”utf-8” tells the browser to use the unicode universal character set transformation format—8-bit.

    The title shows up as the title of the browser window.

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

    The header element closes before the body element opens.

    The Body Element

    Markup written in the body element shows up in the viewport, or browser window. Think of this element as encompassing everything that appears in the browser window.

    Everything you write comes between the opening and closing body tag. In the following, only “Hello World!” will show. Comments are not rendered by the browser.

    <body>
    <!-- Comment your Work! -->
    <p>Hello World!</p>
    </body>
    

    The body element closes before the html element closes.

    The Closing HTML element

    Closing the HTML element is the last tag on the page. It closes the tag that holds all of the other elements in the document.

    </html>
    



     

    Element or a Tags?

     

    An element is a single “chunk” of code comprising of a start and ending tag. They are representations of a thing for the browser, an object. Elements have all kinds of properties for the browser, like firstChild, etc.

    <div>This is a div element</div>
    

    Tags is the opening and closing code of the elements. <div> is a tag. <div>content</div> is an element.

    Elements are not tags. Some people refer to elements as tags (e.g., “the P tag”). Remember that the element is one thing, and the tag (be it start or end tag) is another. For instance, the HEAD element is always present, even though both start and end HEAD tags may be missing in the markup.” From W3 HTML specification

     

    The Inherent Structure of HTML

     

    HTML is concerned with the structure of the content, and not with how the content should be displayed.

    The natural flow of content is inline, meaning that content flows horizontally, like the letters on a line of text. In English, that is from left to right but it could be in any direction.

    In addition to the horizontal inline flow of content, elements can be determined to be block like and flow vertically. Block elements do not flow like characters but like paragraphs, as entire blocks of text. By default, their width expands to fill the parent element and the flow is vertical. They flow down the page, starting from the upper left hand corner.

    In HTML, block elements cannot descend from (be a child of) inline elements. Inline elements are the content of a block element.

    CSS can change the display property of an element. It can make inline elements display as block elements, and block elements display as inline elements. That is very useful, usually to make inline elements act like block elements.

    Valid HTML requires that block level elements do not descend from inline elements. Changing the elements displays with CSS does not change the validity requirements of the HTML document.

    Tag Attributes and Values

     

    Tag Attributes

    HTML tags can take attributes, which describe certain aspects of the elements, with different elements having various assigned attributes. There needs to be a space between each attribute. Attributes for the img tag, for example, are src, width, height, class, and alt.

    Example: <img src="file_name" alt="logo">

    Example: <a href="file_name">File Name</a>

    Values

    Every attribute has a value, even if it is an empty value. For example, the value of the src (source of the image) is the location and name of the image. While it is no longer a requirement to put either double or single quotes, as long as there are no spaces or other non-alphanumeric characters, it still best practice to do so.

    Example: <img src="file_name" alt="logo">

    Example: <a href="file_name">File Name</a>

    Role Attributes

    The role attribute describes the role(s) the current element plays in the context of the document. In the official language of the W3 “The XHTML Role Attribute allows the author to annotate XML Languages with machine-extractable semantic information about the purpose of an element. Use cases include accessibility, device adaptation, server-side processing, and complex data description.”
    Example: <nav roll="navigation">

    Understanding the Tag Hierarchy

     

    DOCKTYPE

    html

    head

    meta
    title
    style

    body

    main

    header

    nav

    ul

    li
    li
    li
    li

    section

    article

    h2
    p

    p

    img

    figure

    img
    figcaption
    p
    footer

    HTML is a collection of elements arranged in a kind of containment hierarchy. This is a parent – child relationship, where the enclosing tag is the parent of the enclosed tag, which is its child. The entire structure can be likened to a tree, with the <html> tag as the single trunk from which the rest of the branches arise, first splitting into the two main branches, the <head> and the <body>. inside the body tag are all of the other branches that make up the document.

    After the <doctype>, the HTML document starts with the <html> element that contains all other elements. It contains only two tags, the <head> and the <body> tags.

    The <head> tag contains information about the page (meta-information) but that is not visible, like the <title> tag, <meta>tags and <html>, <style> and <script> tags and links <link>to styles and scripts.

    The <body> tag contains all of the content, everything that’s visible in the browser window. The tags are usually several levels deep. Nesting tags is very useful, for it groups elements together. This makes it easy to create the different parts of the layout.

    In the figure on the right, the <wrapper> contains all of the other visible content. This element is usually given automatic margins that center it horizontally in its parent tag, the <body>. If the <wrapper> is moved to the right, all the child elements contained within it are moved to the right as well.

    Because each element is a child of another element, there are only clearly determined paths. For example, the <img> is a child of <p>, which is a child of <article>, which is a child of <section>, which is a child of <wrapper>. The complete path of the <img> tag is html body wrapper section article p img. This path would select all images in the paragraphs contained in article, section, wrapper, body, html. Since there are no other images, only the image with the red background is targeted by this path. The <img> in the figure has a different path, for example.

    How to Write the Code

     

    A tab is used to show how many levels the code is nested from the <html> element. This results in a visual way to check if the code is nesting properly. The code should look like :

    <html>
    	<head>
    		<title>title </title>
    	</head>
    	<body>
    		<main>
    			<section>
    				<header>
    					<h1>Headline for Page</h1>
    				</header>
    				<article>
    					<p>content
    				</article>
    				<footer>
    				</footer>
    			</section>
    		</main>
    	</body>
    </html>
    

    To make it easy on you, there are tools that let you clean up your hierarchies automatically. You’ll want to remember this link right before you hand in your midterm and at the end of the semester, when you hand in your final.

    The DOM

     

    how your browser renders websites
    how your browser renders websitessource

    The HTML file with all of its codes and content gets parsed by the browser. The syntax of each tag will be analyzed to see how it fits together according to the HTML rules. This results in a document object model where each node represents a branch on the tree.

    General Rules To Follow

     

    HTML5 has loosened up the rules somewhat but it is still desirable to follow these rules for well formed HTML documents.

    Close Every Tag
    Most Tags contain content, meaning that there is an open tag and a closing tag to signify where the content starts and where it ends. Some tags do not need to close, like <img>because there is no content. These tags are pointer to content, and get replaced by that content. Other tags are self closing, like the <meta /> and <br /> tags. List of self-closing tags: area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, and wbr.

    Accidentally not closing a tag can cause all kinds of havoc and will be flagged when validating. It is a common occurrence in the first few weeks of writing code.

    Correctly Nest Every Tag
    If a tag opens before a preceding one closes, it must be closed before that preceding one closes. <header><h1>Title</h1></header> not <header><h1>Title</header></h1> CSS relies on proper nesting to target styles to elements, so you have to get this right. In this example, the </h1> tag is nested in the </header> tag, and is the child of the header, which is the parent tag. As a container, a tag acts like a group, and moving a parent also moves all of the enclosed children. Likewise, absolute positioning is based on the coordinates of the parent element.

    If you visualize each element as a node on a tree, it is obvious that you cannot open a tag before the previous tag is closed. If you make a mistake, the browsers can sometimes repair the damage, and everything still displays correctly but don’t count on it, and different browsers have different levels of damage control.

    Inline Tags Cannot Contain Block Level Tags.
    Block-level elements follow one another according to the document flow, one below the other. Inline elements follow one another as characters in a paragraph. While it would seem obvious to not mix these two up, the validator will catch you if you do.
    Keep Tags Lower Case
    This is a requirement of XHTML5, which we will not concern ourselves with but its a good idea anyway.

     

    Tags Used to “Mark Up” the Content

     

    Learning HTML comes through writing HTML. The more you code, the easier it becomes till it’s second nature. The content is divided into inline and block tags.

    • Block elements display like paragraphs, coming one after the other vertically down the page in the document flow.
    • Inline elements display just like characters, coming one after the other horizontally till the end of the line. The line then breaks and resumes at the beginning the next line down, and so on.
    • CSS allows you to override the object’s default display and make inline elements display like block elements or vice versa. You’ll learn about that later.

    There are many HTML elements. Mozilla organizes them according to function. That’s helpful. Don’t memorize them. You will remember the ones you use most often and you can always look up the other ones up. Here are all the elements you’ll most likely use:

    Inline Elements

     

    These elements display just like characters, coming one after the other horizontally, till it comes to the end of the line.

    span

    The span tag selects inline content.

    So much information.

    So much <span style="color: red;">information</span>.

    strong

    increases importance

    So much information.

    So much <strong>information</strong>

    emphasis

    for emphasis

    So much information.

    So much <em>information</em>

    line break

    Breaks the line without creating a new paragraph.

    So much
    information.

    So much <br />information.

    Inline Quotations

    Quotations inside of a paragraph can get automatic quotes when you use this tag and the following CSS pseudo elements. (q:before {content: ““”; } q:after {content: “””; }).

    So much information.

    So much <q>information</q>.


    Anchor Tag (Links)

    The anchor element anchors a URL (uniform resource locator, or a unique web address) that targets the destination id or web page by using the href (hypertext reference) attribute.

    Any tag can be a target, within any document on the world wide web. To target a tag, it has to contain an id <h3 id="anchor">.

    To target the id, you need to use the id identifier, the hash tag # and the id name itself. <a href="#anchor">.

    Hyperlink to destination on the same page

    Click the example below and you’ll see the page jump just a little.

    Hyperlinks to other pages

    A hyperlink can address any unique webpage on the world wide web. It can use an absolute address, or a relative address, if the page is on the same server.

    Absolute Hyperlink Address

    An absolute address starts with http://, as in the address of the page that you are on (look up at the address bar)<a href="http://b.parsons.edu/~dejongo/01-writing-html5/">Writing HTML5</a>.

    Relative Hyperlink Address

    If the page is on the same server, it is possible to omit the absolute reference, and specify the path to the document from the location of the document containing the link.

    Links to a location on the same page are always relative to the page itself.

    Targeting tags on other pages

    Links to a location an another page come at the end of a absolute or relative address.

    and

    Image Tag

    The image tag gets replaced by the image. The img tag does not have a closing tag.

    If the image is not at the location specified by the src attribute you will see a generic missing image icon.

    There has to be an alt attribute so that text will appear if the image does not show up. The img tag will be flagged by the validator if it does not have an alt tag. The information is used by screen readers to explain what the image is about to blind people who listen to web pages. It is also a good idea for illustrators, designers, photographers and other people relying on images to load up the description of each image so search engines can include that in people’s searches.

    The title attribute is optional. The title shows up when you hover over the image for a second or more.
    description of image for screen readers or when images are turned off

    <img src="image_location/name_of_image" alt=“required description of 
    image for screen readers or when images are turned off" title="Final Thumbnail" >

    Comments

    Comments are a way to add notes or hide code. Comments are not displayed by the browser. Use them to notate your document with a description of what’s going on in each part of the document.

    Comments will help remind you why you did something a certain way (or help someone else figure out how to read your code).

    You can also use comments to temporarily hide code that you do not want to use but do not yet want to delete.

    Do not use two dashes in a row — within the comment, as that causes confusion in some browsers.

    <!--
    Comment your Work! 
    -->


    Block-level Elements

     

    Block elements display like paragraphs, coming one after the other vertically down the page in the document flow.

    div

    div stands for division. It is the generic block element, used when an element is needed for styling purposes, or as a convenience for scripting. The <div> element represents nothing, has no semantic meaning. Do not use in place of elements that have semantic meaning. It is not equivalent to the HTML5 section element.

    content
    <div style="background: pink; padding: 10px;">content</div>

    Headlines

    How a headline looks depends on how they are styled. You should use headlines to structure your content, not based on how they look.

    Headline h1

    Headline h2

    Headline h3

    Headline h4

    Headline h5
    Headline h6
    <h1>Headline h1</h1>
    <h2>Headline h2</h2>
    <h3>Headline h3</h3>
    <h4>Headline h4</h4>
    <h5>Headline h5</h5>
    <h6>Headline h6</h6>
    

    paragraph

    paragraph bla bla bla bla.

    paragraph bla bla bla bla.

    <p>paragraph  bla bla bla bla.</p>
    <p>paragraph  bla bla bla bla.</p>
    

    Block Quote

    Used to style quote that takes up an entire paragraph. It is indented and given a different style.

    paragraph bla bla bla bla.

    So much information.

    <p>paragraph  bla bla bla bla.</p>
    <blockquote>So much information.</blockquote>
    

    Thematic Break (Horizontal Rule)

    Although previous versions of HTML defined the hr element only in presentational terms, as in horizontal rule, the element has now been given the specific semantic purpose of representing a “paragraph-level thematic break” which is to be styled using CSS. For legacy reasons, browsers still render the <hr> as a horizontal rule.


    <hr>
    

    CSS:

    hr {
    	display: block;
    	margin-before: 0.5em;
    	margin-after: 0.5em;
    	margin-start: auto;
    	margin-end: auto;
    	border-style: inset;
    	border-width: 1px; 
    }

    ordered list

    Ordered lists are numbered sequentially.

    Ordered List

    1. list item
    2. list item
    3. list item
    4. list item
    5. list item
    <h3>Ordered List</h3>
    <ol> 
    <li> list item </li> 
    <li> list item </li>
    <li> list item </li>
    <li> list item </li>
    <li> list item </li>
    </ol> 
    

    Continuation of the Ordered List

    If you plan on breaking the list into several lists but want them to be numbered sequentially, use the start attribute start="5". This would start the list at 5 instead of 1.

    1. list item
    2. list item
    3. list item
    4. list item
    5. list item
    <ol start="6"> 
    <li> list item </li> 
    <li> list item </li>
    <li> list item </li>
    <li> list item </li>
    <li> list item </li>
    </ol>

    Unordered List

    Unordered lists is for a collection of unordered items, where the order would not change the meaning of the list. It is always used for navigation, with each menu item considered as part of the list. The unordered list is styled to remove the list style.

    • list item
    • list item
    • list item
    • list item
    • list item
    <ul> 
    <li> list item </li>
    <li> list item </li>
    <li> list item </li>
    <li> list item </li>
    <li> list item </li>
    </ul>

    Definition Lists

    Definition lists is for a list of terms and corresponding definitions. The term to be defined is listed first with the definition coming after the term. A term can have multiple definitions, and a definition can have multiple terms. A definition header can precede the definition.

    List Header

    Term 1
    This is the definition of the first term.
    Term 2
    This is the definition of the second term.
    <dl>
    <lh>List Header</LH>
    <dt>Term 1</dt>
    <dd>This is the definition of the first term.</dd>
    <dt>Term 2</dt>
    <dd>This is the definition of the second term.</dd>
    </dl>
    
    term
    definition1
    definition2
     
    <dl>
      <dt>term</dt>
      <dd>definition1</dd>
      <dd>definition2</dd>
    </dl>
    
    term1
    term2
    definition
     
    <dl>
      <dt>term1</dt>
      <dt>term2</dt>
      <dd>definition</dd>
    </dl>
    

    Interactive Elements: details

    The details disclosure element does exactly what you think it does. It toggles information that is initially hidden, disclosing it. It takes two tags, the <disclose> tag and the <summary> tag. The summary tag has a triangle in front of it that when clicked discloses the hidden information.

    Details

    Something small enough to escape casual notice.

    <details>
        <summary>Details</summary>
        Something small enough to escape casual notice.
    </details>
    

    table

    The HTML table layout mode allows authors to arrange data — text, images, links, forms, form fields, other tables, etc. — into rows and columns of cells.

    Simple Table

    table cell item table cell item
    table cell item table cell item
    <table> 
    <tr> 	<td> table cell item </td>
    <td> table cell item </td> 
    </tr> 
    <tr> 	<td> table cell item </td>
    <td> table cell item </td> 
    </tr> 
    </table>

    Fully Loaded table

    A table can have a head, multiple table bodies and a table footer. You can span both rows and columns with the rowspan="2" or colspan="2" attribute. This allows for the header to expand down and the footer to expand across in the following example.

    The Caption Holds the Title of the Table
    Head 1 Head 2a Head 3
    Head 2b
    table cell item table cell item table cell item
    table cell item table cell item table cell item
    table cell item table cell item table cell item
    table cell item table cell item table cell item
    The footer is a place for information about the table.
    <table id="table">
    <caption>The Caption Holds the Title of the Table</caption>
    <col><col><col>
    <thead> 
    <tr><th rowspan="2">Head 1</th><th>Head 2a</th><th rowspan="2">Head 3</th></tr>
    <tr><th>Head 2b</th></tr>
    </thead>
    <tbody>
    <tr> <td> table cell item </td>  <td> table cell item </td>  <td> table cell item </td></tr>
    <tr> <td> table cell item </td> <td> table cell item </td> <td> table cell item </td></tr>
    </tbody>
    <tbody>
    <tr> <td> table cell item </td>  <td> table cell item </td>  <td> table cell item </td></tr>
    <tr> <td> table cell item </td> <td> table cell item </td> <td> table cell item </td></tr>
    </tbody>
    <tfoot>
    <tr><td colspan="3">The footer is a place for information about the table.</td></tr>
    </tfoot>
    </table>
    

     

    Iframe

     

    An inline frame places another HTML document in a frame. The inline frame can be the “target” frame for links defined by other elements, and it can be selected by the user agent as the focus for printing, viewing its source, and so on.

    The iframe is exhibited with attributes that are determined using the equivalent CSS in the demo width: 98%; height: 300px; border: 1px solid #f000; overflow: scroll;.

    <iframe src="01-html-css-primer/">height=300 width=200 frameborder=1 scrolling=yes >You need a Frames Capable browser to view this content.</iframe>

    Writing HTML, Absolute and Relative Addresses, Tools of the Trade

    Target iframe from Link

    You can target any page to appear in the iframe by naming it and using the target attribute with the name target="iframeDemo" as demonstrated above. Click on the links above to load different documents.

    A destination anchor is used to position the Writing HTML document at the iframe section. That requires an anchor with the same name <a id="i-frame">. See the link tag above.

    <a href="01-writing-html5/#i-frame" target="iframeDemo" >Writing HTML</a>
    <a href="01-absolute-and-relative-addresses/" target="iframeDemo" >Absolute and Relative Addresses</a>
    <a href="01-tools-of-the-trade/" target="iframeDemo" >Tools of the Trade</a>
    

     

    HTML5 tags

     

    Before HTML5, the generic markup elements, <div> and <span>, were used to mark up the page. That means the code itself had no way of determining what the content was.

    HTML5 changed that.

    HTML5 standardized a lot of best practices to create semantically relevant block level tags that help organize the document. It is now possible to tell header content from the content of an article by looking at the tags alone. The most important of the new elements are: <main>,<section>, <header>, <nav>, <article>, <aside>, <footer>, <figure>, <figcaption>, <hgroup>, <wbr>.

    Document Layout

    <main>
    <section>
    
    	<header>
    
    		<hgroup>
    			<h1>Name</h1>
    			<h2>Name</h2>
    		</hgroup>
    
    	</header>
    
    	<article>
    		<p>content <wbr> content</p>
    

    the <wbr> tag, or Word Break Opportunity tag, is an inline tag that specifies where in a text it would be ok to add a line-break.

    		<aside>
    			<p>content</p>
    		</aside>
    
    	</article>
    
    	<footer>
    	</footer>
    
    </section>
    </main>
    

    Adding Navigational Links

    Using an unordered list.

    <nav>
    	<ul>
    		<li><a href="#">link to homework</a></li>
    		<li><a href="#">link to homework</a></li>
    		<li><a href="#">link to homework</a></li>
    	</ul>
    </nav>
    

    Adding a Picture

    With a caption.

    <figure>
    	<img src="example.jpg" alt="example" >
    	<figcaption> Caption </figcaption>
    </figure>
    

    Copy and paste this basic HTML5 template into a blank Textwrangler file. It has most of these elements and a basic header, so you can start coding the content right away. Repetition will acclimate you to writing HTML.