html foundations, part 1

89
22-3375 Web Design I // Columbia College Chicago HTML Foundations, pt 1

Upload: shawn-calvert

Post on 28-Jan-2015

115 views

Category:

Education


2 download

DESCRIPTION

http://shawncalvert.com/webdesign-1 Web Design 1 Columbia College Chicago

TRANSCRIPT

Page 1: HTML Foundations, part 1

22-3375 Web Design I // Columbia College Chicago

HTML Foundations, pt 1

Page 2: HTML Foundations, part 1

Directories

Page 3: HTML Foundations, part 1
Page 4: HTML Foundations, part 1

Room 902

<a href=” ”>

Page 5: HTML Foundations, part 1

Room 902Room 901 Room 903

9th Floor

9th Floor/Room 902/

Page 6: HTML Foundations, part 1

Room 902Room 901 Room 903

9th Floor

../Room 902/

Two dots in front of a forward slash means: “step up one directory.” In this example it says:

“step out of room 903 and then back into room 902, talk to “

Page 7: HTML Foundations, part 1

Room 902Room 901 Room 903

9th Floor8th Floor 10th Floor ++

WabashCampus

Mich AveCampus

Book & Paper Center

++

ColumbiaCollege

Universityof IL SAAIC ++

Page 8: HTML Foundations, part 1

/Columbia College/Wabash Campus/9th Floor/Room 902/

http://Columbia College/Wabash Campus/9th Floor/Room 902/

Relative link to rootA relative link (does not start with “http://”) with a slash at the beginning forces the link to start at the root of the website. This will only work on the server, not when you are working locally.

Absolute linksAbsolute links are typically used for linking to pages or !les outside of your site’s directories.

Page 9: HTML Foundations, part 1

The index !le

When an absolute link is directed to a folder, the browser needs to know which !le to open. By default, it looks for a !le named “index” (the extension is not important, usually is it index.html, or index.php). This is why the homepage is always named “index”.

So, <a href=”http://www.mysite.com/”> and <a href=”http://www.mysite.com/index.html”> will open the same !le.

root directory (www.mysite.com)

index.html

images

logo.png

report.pdf

stylesheet.css

Page 10: HTML Foundations, part 1

Tutorial: Relative Linking

Create a webpage with all three of these images placed:

Page 11: HTML Foundations, part 1

FTP

Page 12: HTML Foundations, part 1

File Transfer Protocol

Local(your computer)

Host(www)

Page 13: HTML Foundations, part 1

FTP Software

All premium code editors have ftp built in, which allows you to sync your project !les to the server easily.

You will often need to post or download !les from the server manually. For this you can use dedicated ftp software:

Fetch, Transmit and FileZilla & Fireftp (both free) are all good choices for Mac.

Page 14: HTML Foundations, part 1
Page 15: HTML Foundations, part 1
Page 16: HTML Foundations, part 1

Wordpress

Page 18: HTML Foundations, part 1

index.php database

Dynamic CMS

Page 19: HTML Foundations, part 1
Page 20: HTML Foundations, part 1

WALKTHROUGH: Set up a theme in Wordpress

Page 21: HTML Foundations, part 1

WALKTHROUGH: Create a post in Wordpress

Page 22: HTML Foundations, part 1

HTML

Page 23: HTML Foundations, part 1

Hyper Text+

Markup Language

Page 24: HTML Foundations, part 1

Hyper Text

Page 25: HTML Foundations, part 1

Markup Language

A markup language is a set of markup tags.

The purpose of the tags are to describe page content.

Page 26: HTML Foundations, part 1

Markup Language

Without any markup to give your content structure, the browser renders unformatted and unstyled text, also known as “plain text”.

Page 27: HTML Foundations, part 1

Markup Language

HTML tags give structure and meaning to your content. “Semantic markup” refers to the use of meaningful tags to describe content (e.g. using header tags for header content).

Page 28: HTML Foundations, part 1

Markup Language

Once your content is marked up, the browser applies built-in default styles to the tags. While you can override these styles with css, your marked up, non-css styled document should be readable and have a clear hierarchy.

Page 29: HTML Foundations, part 1
Page 30: HTML Foundations, part 1

Rich Text to Plain Text

Just as with InDesign, when you receive text from someone that has already been formatted (e.g. from Word), you should always paste that text into TextEdit, and convert to plain text.

Page 31: HTML Foundations, part 1

Rich Text to Plain Text

In TextEdit, go to ‘Format’ to ‘Make Plain Text.’

Page 32: HTML Foundations, part 1

Rich Text to Plain Text

Copy and paste the plain text into your HTML and start typing in tags to recreate the document structure.

Page 33: HTML Foundations, part 1

HTML Elements

Page 34: HTML Foundations, part 1

Anatomy of an Element

An HTML element includes boththe HTML tag and everything between

the tag (the content).

<tag>Content</tag>

Page 35: HTML Foundations, part 1

Anatomy of an Element

The element tag gives the content structure and meaning.

<tag>Content</tag>

Page 36: HTML Foundations, part 1

Anatomy of an Element

Tags normally come in pairs. The!rst tag is the start tag, and the second

tag is the end tag.

<tag>Content</tag>

Page 37: HTML Foundations, part 1

Anatomy of an Element

HTML has a de!ned set of tag names (also called keywords) that

the browser understands.

<h1>Main Headline</h1>

Page 38: HTML Foundations, part 1

Anatomy of an Element

Most elements can have attributes,which provides additional informatin

about the element.

<html lang=”en”></html>

Page 39: HTML Foundations, part 1

Anatomy of an Element

Attributes always follow the sameformat: name=”value”. You can use

either single or double quotes.

<div class=”left-nav”></div>

Page 40: HTML Foundations, part 1

Where did those text styles come from?

Page 41: HTML Foundations, part 1

Where did those text styles come from?

All browsers have what is called a“client stylesheet” that applies formatting

to your html elements, such as text size, font,color, margins, line-height, and much more.

Your custom css overrides some of these default styles.

Page 42: HTML Foundations, part 1

Tags: Basic Structure

Page 43: HTML Foundations, part 1

doctype

html

head

body

Page 44: HTML Foundations, part 1

<!DOCTYPE html>

EXCEPTION

The doctype is not actually a tag, but a declaration, telling the browserwhat kind of html you are using. The

doctype above declares HTML 5.

Page 45: HTML Foundations, part 1

<html></html> STRUCTURE

The <html> element de!nesthe whole HTML document.

Page 46: HTML Foundations, part 1

<html lang=”en”></html> STRUCTURE

The <html> element should have a “lang” attribute to tell the browser what language

your page is written in.

Page 47: HTML Foundations, part 1

<head></head>

The <head> contains special elements that instruct the browser where to !nd stylesheets & javascript !les, as well as

provide meta data about your site.

Page 48: HTML Foundations, part 1

<body></body>

The <body> element contains the document content (what is shown

inside the browser window).

Page 49: HTML Foundations, part 1

Tutorial: Set up a basic html template

Page 50: HTML Foundations, part 1

Nesting

The use of our !rst three tags (html, head and body), introduces and important concept: Nesting, which is when tags “wrap” other tags. When you create markup, you should indicate nesting by indenting the nested tags with 2 spaces (preferred) or a tab.

Page 51: HTML Foundations, part 1

Document Hierarchy: Parents, children and siblings

Just as in a genealogy tree, the family hierarchy is described in terms of relationships. All elements in the document have a parent (up to ‘document’, which is at the top), and may have children (nested inside) or siblings (placed alongside).

<parent x>

<child and sibling y> </child and sibling y>

<child and sibling z> </child and sibling z>

</parent x>

Page 52: HTML Foundations, part 1

Tags: Head Tags

Page 53: HTML Foundations, part 1

titlebasemetalink

scriptstyle

Page 54: HTML Foundations, part 1

<title></title> STRUCTURE

The title element:• de!nes a title in the browser toolbar, • provides a title for the page when it is added to favorites• displays a title for the page in search engine results.

Page 55: HTML Foundations, part 1

<title>My Portfolio</title>

EXAMPLE

Page 56: HTML Foundations, part 1

<meta> STRUCTURE

The <meta> tag provides metadata about the HTML document. Metadata will not be displayed on the page, but

will be machine readable.

Page 57: HTML Foundations, part 1

<meta charset="utf-8"> STRUCTURE

The <meta> is a single tag —it does not require a closing tag.

EXAMPLE

Page 58: HTML Foundations, part 1

Tags: Paragraphs

Page 59: HTML Foundations, part 1

<p></p> STRUCTURE

The <p> element is a block-level tag that contains default space-before and

space-after properties (making indentionunnecessary.)

Page 60: HTML Foundations, part 1

EXAMPLE

Page 61: HTML Foundations, part 1

Tags: Headings

Page 62: HTML Foundations, part 1

<h1></h1> through

<h6></h6>

The header elements are block-leveltags that give you the ability to assignsemantic weight (importance) to your

headlines.

Page 63: HTML Foundations, part 1

EXAMPLE

Page 64: HTML Foundations, part 1

Tags: Lists

Page 65: HTML Foundations, part 1

<ul>

<ol>

<dl>

Page 66: HTML Foundations, part 1

List tags are always used in nested pairs.

The wrapping tags de!ne the list type, and indicate where the list series begins

and ends.

NOTE

Page 67: HTML Foundations, part 1

<ul> <li></li>

</ul>

STRUCTURE

The <ul> (unordered list) element is a block-level tag that wraps a series of <li> (list item) elements. The default property

for the list items is a bullet.

Page 68: HTML Foundations, part 1

EXAMPLE

Page 69: HTML Foundations, part 1

<ol> <li></li>

</ol>

STRUCTURE

The <ol> (ordered list) element is a block-level tag that wraps a series of <li> (list item) elements. The default property

for the list items is decimal (1, 2, 3).

Page 70: HTML Foundations, part 1

EXAMPLE

Page 71: HTML Foundations, part 1

Tags: Formatting

Page 72: HTML Foundations, part 1

(partial list)

bigq

blockquotecite

i (or) em

smallb (or) strong

subsupdel

Page 73: HTML Foundations, part 1

EXAMPLES

Page 74: HTML Foundations, part 1

EXAMPLES

Page 75: HTML Foundations, part 1

Tags: Special Elements

Page 76: HTML Foundations, part 1

<br> STRUCTURE

The <br> element is a single, inline tag that works anywhere in the body to create a single line break. In a <p>

element, it is the equivalent of asoft return.

Page 77: HTML Foundations, part 1

EXAMPLE

Page 78: HTML Foundations, part 1

A horizontal rule is created by using the single tag <hr>. It is a block

level element (so it will clear the elements above and below.

<hr>

Page 79: HTML Foundations, part 1

Escape & Special Characters

In HTML, some characters are reserved for the code, like brackets (< >), ampersands (&), and quotes (“ and ‘). Other characters, like em & en dashes, em spaces, curly quotes, copyright symbols, fractions, etc, are not included in the “standard” character sets. In both cases, you work around this by using special codes that will translate into those characters in the browser. Below are the ones you will probably use the most:

& &amp;

“ &ldquo;” &ldquo;‘ &amp;’ &amp;

– &ndash;— &mdash;© &copy;← &larr;→ &rarr;

Page 80: HTML Foundations, part 1

Tags: Images

Page 81: HTML Foundations, part 1

<img> STRUCTURE

The <img> element is a single, inline tag that works anywhere in the body

to insert a jpg, png, svg or gif !le.

Page 82: HTML Foundations, part 1

The <img> tag is empty;it requires a src (source) attribute to

“pull in” the image into the page. It does not require an “alt” tag, but if the image

is essential to the content (e.g. not a background or decorative element), it

should have one.

NOTE

Page 83: HTML Foundations, part 1

<img src="images/logo.gif" alt=”Acme Corp”>

STRUCTURE

All <img> tags should also contain analt attribute. This is “alternate” text

that will appear if for some reason the image link is broken or the !le is unavailable.

EXAMPLE

Page 84: HTML Foundations, part 1

Tags: Anchors (linking)

Page 85: HTML Foundations, part 1

<a></a> STRUCTURE

The <a> element is an inline tag that works anywhere in the

body to create a hyperlink.

Page 86: HTML Foundations, part 1

EXAMPLE

<a href="aboutme.html">About Me</a>

<a> tags are always used in pairs, wrapping the content you want to activate

as a link. If you use an absolute URL, it must start with “http://”.

<a href="http://www.colum.edu">My school</a>

Page 87: HTML Foundations, part 1

Relative vs Absolute links

Whenever you link to a !le with an ‘href‘ (hypertext reference ) or ‘src’ (source) attribute, you are providing the browser and address to the resource. That address can be relative or absolute.

root directory (www.mysite.com)

index.html

images

logo.png

report.pdf

stylesheet.css

Page 88: HTML Foundations, part 1

Relative vs Absolute links

A relative link is relative to the resource’s location in its directory. It is like saying “the restaurant is 2 blocks away.”In the example below, if ‘logo.png‘ were linked from the homepage (index.html), the tag would be:

<img src=”images/logo.png”>

root directory (www.mysite.com)

index.html

images

logo.png

report.pdf

stylesheet.css

Page 89: HTML Foundations, part 1

Relative vs Absolute links

An absolute link is the full address to the resource’s location in the entire web. It is like saying “the restaurant is at 222 West Grand, Chicago IL 60625.”

<img src=”http://www.mysite.com/images/logo.png”>

root directory (www.mysite.com)

index.html

images

logo.png

report.pdf

stylesheet.css