Beruflich Dokumente
Kultur Dokumente
Course Description
In this class, we will explore the fundamentals of web site creation. We’ll
look at the software, on-line resources, and reading materials which will
help you build outstanding web sites. The class will consist of a mixture of
hands-on exercises, lectures, and demonstrations. Topics covered will
include:
– Web design principles
– HTML basics
– Adding images to web pages
– Linking web pages
– Building tables for data and graphical layout
– Graphics production for the web
By the end of the class, you will have built a website and be ready to strike
out on your own. Students MUST have access to a computer, be familiar
with computer basics, and have access to the Internet. We will be working
on the IBM-PC platform; however, since the Web is cross-platform, you can
apply the knowledge you gain from this class to other computer platforms.
More Administrivia
• Resources
– Each week you will receive supplemental handouts and in-
class exercises. Copies of the handouts and links to
resources will be posted to the CS21 website:
• http://www.stanford.edu/group/csp/cs21/
Week 1 Agenda
Web Terminology
• FTP (File Transfer Protocol), SFTP (Secure File Transfer Protocol)
- allows computers to exchange files over a network
• HTML (HyperText Markup Language) - the "programming" language used to write web
pages
• HTTP (HyperText Transfer Protocol) - the internet protocol which allows web pages to
work
• Protocol - ground rules or "language" that internet computers use to "talk" with each
other
• Source file - the set of tags and text which make up a web
page. Browsers process the source file to make the web page
look the way the designer wanted it to look.
• URL (Uniform Resource Locator) - a web address; indicates the
location of a web resource as well as the protocol needed to
access it
• Web browser/navigator/client - the software application which displays web pages
• Web page - a single page on the web (a "homepage" is the first web page on a web
site)
• Web server - the computer or network of computers which stores web pages
• Web site - a collection of web pages, usually on a particular topic or business
CS21: Web Site Design Week 1 Slide 10 of 20
5
How web pages work…
1) Client (user) tells the browser to request a web page using the http protocol
2) Request goes over the internet to the web server
3) Web page is found on the web server
4) Copy of the source code for the web page is sent back to the original
computer
5) Browser processes ("translates") code into web page
The
Internet
Web pages are simply made up of plain ASCII text. Web browsers
process the codes used on web pages to display a fully formatted
web page. But the pictures, colors, and other non-text items on a
web page aren't actually on the web page itself -- the
web page itself is
simply text,with the
formatting and
graphics encoded.
You
can look at the
code for any web
page by going to Slide 12 of 20
the "View" menu
and
choosing "Page
Source".
6
Introduction to HTML
• HTML stands for "HyperText Markup Language"
• HTML is a collection of text surrounded by tags which modify
the text of the document.
• All tags are encoded in angle brackets (<>).
• Tags work in pairs -- one turns on the modification, one turns it
off. Stop tags look just like start tags except they have a slash
(/) in front.
<tag>affected text</tag>
• Some tags work on their own. Since they don’t have a closing
tag, we place a / at the end of the tag. The Horizontal Rule tag
<hr /> is an example.
• Most tags have attributes which can modify how they function:
<tag attribute="value">affected text</tag>
Tag examples
<em>I want this in italics</em>
•<br />
–Line break tag. Used when the webmaster wants a carriage
return but doesn't want a blank line to follow
•<hr />
–Horizontal Rule. Used to place a straight line across the page.
Header Tags
Header Tags -- Used for marking sections and
subsections in a document. Using
Cascading Style Sheets (CSS), you
can change the default meaning for
the tags (more on this next week).
Formatting text
• Bolding and Italicizing:
– <strong>text you want bold</strong>
<b> you can also use the bold tag (no longer recommended) </b>
– <em>text you want in italics</em>
<i> you can also use the italics tag (no longer recommended) </i>
Week 2 Agenda
• Unfinished business
• Review of Week 1
• Adding Links
• Adding Styles (Cascading Style Sheets)
• File Transfer Protocol (FTP)
text a text a
text b
text b
A = Anchor
HREF = hypertext reference
URL = Uniform Resource Locator
(a web address, such as http://www.stanford.edu/)
CS21: Web Site Design Week 2 Slide 7 of 22
Colors
• Web colors are specified by HEXADECIMAL code which describes
the RGB value. RGB stands for RED GREEN BLUE. These are the
primary colors that make up all other colors. The hexadecimal code
includes two characters for each color. Hexadecimal codes have the
format: #RRGGBB
• Browsers greater than version 3 can also correctly process 256 named
colors (red, white, black, turquoise, periwinkle, etc.)
Ref: http://www.stanford.edu/group/csp/cs21/samples/color.html
CS21: Web Site Design Week 2 Slide 10 of 22
5
Using Colors on Web Pages
One way you can setting colors for the entire page is to modify (by adding
attributes to) the <BODY> tag:
<body bgcolor="red" text="yellow" link="green" alink="black" vlink="purple">
• Designers can also specify the font they wish to use on the page. One way to do this is to use the
<font> tag. However, the W3C has recently decided to deprecate both the <font> tag and the use
of the bgcolor attribute -- instead, they want us to start using style sheets. More on how to use style
sheets in the next couple of slides. That said, many web sites today still use the <font> tag.
• Not all systems have the same fonts. If you choose a font that isn't on the user's system, the page won't
look the way you prefer.
<font face="FONTNAME"> [text] </font>
• The default font for browsers is Times. This is a SERIF font. Another popular choice is Arial. This is a
SANS-SERIF font. Another type of font is MONOSPACE, such as Courier.
• One way to avoid the issue of conflicting or missing fonts is to specify the type of font, rather than the
actual font, such as:
<font face="sans-serif"> [text] </font>
• Another way is to put more than one font into the tag. The browser will check to see if the computer has
the font in order:
<font face="Palatino, Arial, sans-serif"> [text] </font>
CS21: Web Site Design
Week 2 Slide 13 of 22
Small size
• COLOR - changes text color (use either hexadecimal code or named color)
<font color="red">Red</font>
Red
The actual style information is included in an HTML comment tag (<!-- commented
text -->) in order to hide it from browsers that don't understand CSS. The TYPE attribute
of the <style> tag defines the type of style sheet being used -- in this case CSS, Cascading
Style Sheets.
CS21: Web Site Design Week 2 Slide 17 of 22
This particular method is most useful if you want to change a single instance of a tag in a
document that already has a style associated with it. When there are multiple styles affecting a
document, the style closest to the tag in question takes precedence. In other words, if I have put a
style in HEAD of the document but also included an INLINE style, that INLINE style will
override the document style for that one instance of the tag.
CS21: Web Site Design Week 2 Slide 18 of 22
9
Using an external .css file
To set a style for an entire site of documents, create a standalone text file with a .css extension (e.g., basic.css)
that contains the necessary style information. Then, link each web page to that CSS file using either the <link>
tag or the import method:
HTML document, using the <link> tag method HTML document, using the import method
<head> <head>
<link rel="stylesheet" <style type="text/css">
type="text/css"
href="basic.css" /> <!--
Homework/Next Week
11
Web Site Design
Stanford University Continuing Studies CS
21
Week 3 Agenda
• Using Special Characters
• Using Graphics on web pages
• Types of web graphics
• Using existing web graphics
• Creating web graphics
• Background graphics
1
Special Characters
• Because the source codes for Web pages are created with
plain ASCII text only, the characters on the source code are
limited to the standard keyboard characters. To have
special characters such as œ, ß, ñ, or © show up on a web
page, designers must utilize special HTML codes.
• Example:
© = © ñ = ñ ß = ß œ = œ
http://www.stanford.edu/group/csp/cs21/samples/ascii.html
Structure of a URL
• Uniform Resource Locators provide links from a page
anywhere on the World Wide Web to any resource on the
Internet.
• Starts with the protocol (defines how the info is to be sent and
received):
Domain
Links
• <a href="http://www.stanford.edu/people/markb/resume.html">
Mark's resume </a>
• This is an absolute link. It defines completely the domain of the host computer
(www.stanford.edu), as well as the path (/people/markb) and the file
(resume.html).
• This is a relative link. Note that the protocol, domain, and path are omitted from the
URL. The browser will assume the current domain and path are to be used.
By current, we mean the domain and directory of the page that is currently being
displayed (ie, relative to the current page, find this page).
<html>
<head>
<title>Bunny Webpage</title> Fully qualified URL
</head>
<body bgcolor="turquoise">
<h2 align="center">BUNNY!</h2>
<p align="center">
Downloading Graphics
• In your web browser:
– Point your mouse over the image and right-click
the image.
• That’s it! Now that I’ve downloaded the image to my computer, I can
refer to it in my webpage with the <IMG> tag.
Animated Graphics
• Using Existing Animations
– Most graphics archives include animated sections
– Most animations are a form of GIF format; in terms of placing
animations on a web page, there is no difference between
an animated GIF and a non-animated GIF (same tag, same
process).
• Creating New Animations
– There are software packages specifically for creating
animations. Animations are a series of static graphics that
are "stitched" together and saved into one file. The browser
shows each of the static images in sequence resulting in the
animations.
Weekly Assignment
• Visit some graphics archives. Choose some
graphics you'd like to have on your pages.
Save them to your hard drive so you'll have
access to them (get permission if they're
copyrighted!)
• Or, if you have the software and skills, create
a graphic or two to use on your site.
• Or, scan a photo into your computer
Week 4 Agenda
• Graphics review
• Setting image size & other tips
• Web Design Issues (separate presentation)
1
Using Graphics on Web Pages
• Graphics on web pages are separate files. Unlike a
Word document, where the graphics actually "live"
within the document, to get a graphic on a web
page, designers point to the graphic file in the HTML
source code like this:
<img src="URL-of-graphic" alt="description of graphic" />
<html>
<head>
<title>Bunny Webpage</title> Fully qualified URL
</head>
<body bgcolor="turquoise">
<h2 align="center">BUNNY!</h2>
<p align="center">
• Next week:
– ImageMaps
– Embedding Sound and Video
– Lists
Week 5 Agenda
• Graphics review
• Imagemaps
• Embedding Sound & Video
1
Using Graphics on Web Pages
(Review)
• Graphics on web pages are separate files. Unlike a
Word document, where the graphics actually "live"
within the document, to get a graphic on a web
page, designers point to the graphic file in the HTML
source code like this:
<img src="URL-of-graphic" alt="description of graphic" />
<html>
<head>
<title>Bunny Webpage</title> Fully qualified URL
</head>
<body bgcolor="turquoise">
<h2 align="center">BUNNY!</h2>
<p align="center">
1. Launch Firefox and locate the website that has the image.
<map name="name-of-map">
<area shape="rect" coords="x,y,a,b" href="link1.html" />
<area shape="circle" coords="x,y,r" href="link2.html" />
<area shape="polygon" coords="x1,y1,a1,b1,x2,y2,a2,b2,…"
href="link3.html" />
</map>
rect
polygon
<area shape="polygon"
coords="x1,y1,a1,b1,x2,y2,a2,b2,…"
href="link3.html" />
• Windows-based PCs
– Dreamweaver
• http://www.adobe.com/software/dreamweaver
– MapEdit
• http://www.boutell.com/mapedit/
• Advantages:
– Page loads instantly. No waiting for large files to download in the
background.
– Works with all browsers, even version 1.1N
• Disadvantages:
– Requires plug-ins or players
– Can't adjust the height/width or location of the video/sound.
<embed> examples
<embed src="bach.mp3" hidden="true"
height="0" width="0" border="0"
alt="Bach's Fugue in D
Major"></embed>
<embed src="movie.mov"
autostart="true" loop="false"
height="640" width="480">
</embed>
CS21 Web Site Design Week 5 Slide 18 of 22
9
<bgsound>
• BGSOUND is not supported by Netscape or
Firefox. You can create a similar effect by
using the EMBED tag, setting the height &
width to 0 and have the clip start
automatically when loaded.
<bgsound>
• BALANCE="XX"
– defines how the volume will be divided between
the 2 speakers
(-10000 to +10000)
• LOOP="TRUE|FALSE"
• SRC="URL"
• VOLUME="XX"
– Defines the volume of the background sound
(-10000 to 0)
Quiet:
<bgsound src="mozart3.wav"
volume="-1000" />
Loud:
<bgsound src="mozart3.wav"
volume="0" />
CS21 Web Site Design Week 5 Slide 21 of 22
Next week…
• Lists
• Tables
Week 6 Agenda
• Unfinished business
• Lists
• WYSIWYG editors
CS21 Web Site Design Week 6 Slide 2 of 22
1
Lists
There are three types of lists in HTML:
• Unordered
– Bulleted lists (disc, circle, square)
• Ordered
– Numbered lists (1,2,3 or a,b,c or I,II,III, or i,ii,iii)
• Definition
– Lists with a "term" and a "definition"
CS21 Web Site Design Week 6 Slide 3 of 22
List tags
• <ol> </ol> = Ordered List
– Attributes: "type=1/a/A/i/I"
• <ul> </ul> = Unordered List
– Attributes: "type=disc/circle/square"
• <dl> </dl> = Definition List
<ul type="circle">
<li> Glory bear </li>
° Glory bear
<li> Osito bear </li>
<li> Brittania bear </li> ° Osito bear
<li> Maple bear </li> ° Brittania bear
<li> Germania bear </li> ° Maple bear
</ul>
° Germania bear
<UL type="square">
<ul type="square">
<li> Glory bear </li>
Glory bear
<li> Osito bear </li>
<li> Brittania bear </li> Osito bear
<li> Maple bear </li> Brittania bear
<li> Germania bear </li> Maple bear
</ul>
Germania bear
<OL type="a">
<ol type="a">
<li> Glory bear </li>
a. Glory bear
<li> Osito bear </li>
<li> Brittania bear </li> b. Osito bear
<li> Maple bear </li> c. Brittania bear
<li> Germania bear </li> d. Maple bear
</ol>
e. Germania bear
<ol type="A">
<li> Glory bear </li>
A. Glory bear
<li> Osito bear </li>
<li> Brittania bear </li> B. Osito bear
<li> Maple bear </li> C. Brittania bear
<li> Germania bear </li> D. Maple bear
</ol>
E. Germania bear
<OL type="i">
<ol type="i">
<li> Glory bear </li>
i. Glory bear
<li> Osito bear </li>
<li> Brittania bear </li> ii. Osito bear
<li> Maple bear </li> iii. Brittania bear
<li> Germania bear </li> iv. Maple bear
</ol>
v. Germania bear
<ol type="I">
<li> Glory bear </li> I. Glory bear
<li> Osito bear </li>
II. Osito bear
<li> Brittania bear </li>
III. Brittania bear
<li> Maple bear </li>
<li> Germania bear </li> IV. Maple bear
</ol> V. Germania bear
Tables
• Tables are one of the more complex HTML elements
you can use
Table example
<table>
<caption>
Beanie Babies!
</caption>
<tr>
<th>Bear Name</th>
<th>Description</th>
</tr>
<tr>
<td>Glory</td>
<td>American Bear</td>
</tr>
<tr>
<td>Osito</td>
<td>Mexican Bear</td>
</tr>
CS21 Web Site Design Week 6 Slide 18 of 22
</table>
9
Creative Use of Tables
• In addition to allowing data to be placed onto
a web site, tables allow designers the ability
to control page layout.
Demos of tables
• http://www.stanford.edu
• http://www.cnn.com
(DEMO -- Dreamweaver)
Next week…
Week 7 Agenda
• Unfinished business
1
Defining styles: head (review)
• You can set a style sheet for a single document by putting the style information in the head of
the document.
The actual style information is included in an HTML comment tag (<!-- commented text -
->) in order to hide it from browsers that don't understand CSS. The TYPE attribute of the
<style> tag defines the type of style sheet being used -- in this case CSS, Cascading Style
Sheets.
This particular method is most useful if you want to change a single instance of a tag in a document
that already has a style associated with it. When there are multiple styles affecting a document, the
style closest to the tag in question takes precedence. In other words, if I have put a style in HEAD
of the document but also included an INLINE style, that INLINE style will override the document
style for that one instance of the tag.
HTML document, using the <link> tag method HTML document, using the import method
<head> <head>
-->
</style>
</head>
Positioning
• This is the most fun but also the most difficult part of CSS.
• Here's how it works: when the browser draws the object on the page, it
places it into an invisible, rectangular box called a bounding box. You
can set the box's exact location on the page (absolute positioning) or
you can offset the box from other elements on the page (relative
positioning). You can also specify the size of the box. You can layer
objects on top of each other. And, you can use clipping to allow certain
sections to show through from lower levels. You can make objects
invisible as well.
4
Defining positions
• To define the position, you must first decide if its position will be absolute or
relative. If you want to absolutely define exactly where an object is, you must use
position: absolute.
#logo { position: absolute; top: 150px; width: 200px; height: 200px
font-family: Arial; font-style: italic; color: green; }
This would create a bounding box as an ID called "logo" that would be 150 pixels
from the top, 200 pixels wide, 200 pixels tall, with a font of Arial, italic, and green.
Position example
Position example 2
• Once you know how to set the horizontal and vertical positioning --
or X and Y axes, you now need to learn about the Z axis. This
allows webmasters to layer objects. Normally, if you put multiple
objects at the same spot, each object will cover the earlier ones.
Using the z-index style, you can specify which layer an object
resides on. By setting the z-index higher or lower, you can move
an object up or down the stack.
Layering Example #1
Next week…
• Forms
• Basic CGI programming
• Forms
– What are Forms?
– Creating a Form Processor
– Creating an HTML form
Mark Branom markb@stanford.edu
http://www.stanford.edu/people/markb/
Week 8 Slide 3 of 22
Week 8 Slide 4 of 22
2
Forms processing HTML part
• Once a user submits the form, the data sent needs
to be processed, usually via a CGI program • <FORM>: marks the form
(often written in PERL, C++, ASP, Visual • <INPUT>: tag used to define variables and field types
Basic, Java, or JavaScript). • TEXT: single-line textbox
• PASSWORD: single-line textbox but in hidden text
• RADIO: radio button single-choice selections
• Many CGI scripts are freely available to • CHECKBOX: checkbox button multiple-choice selections
• RESET: used to reset variables back to default value
download and utilize on your server without • SUBMIT: used to submit form to the CGI script
needing to have much expertise in the • BUTTON: used to submit form to a JavaScript or other client-
programming language: side script
• HIDDEN: used to submit hidden information
• <TEXTAREA>: tag used for multiple-line textbox
– http://www.webmonkey.com/programming/perl_cgi/
• <SELECT>: tag used for pull-down menus
– http://www.scriptarchive.com/
– http://www.cpan.org/scripts/
– http://www.cgiscript.net
– http://www.javascript.com
– http://www.macromedia.com/cfusion/exchange/index.cfm
• Encloses all of the form elements. • Second, the form needs to know where to send the
- contains METHOD and ACTION attributes information. This is the URL being requested from the form,
and is referenced with the ACTION tag. This URL will
• First, the form needs to know how to send the information to the
almost always point to a computer script to decode the form
server. Two methods are available, GET and POST.
results.
• METHOD="GET"
– Most HTML documents are retrieved by requesting a single ACTION="http://www.company.com/cgi/script.pl"
URL from the server. GET tacks on the information from
the form to the end of the URL. Spaces are translated into + • Once you put it all together, your form will usually have the
sign; if there’s more than one variable, they’re separated by following format:
an & sign:
http://search.altavista.com/cgi- <FORM METHOD="POST"
bin/query?q=Stanford+University ACTION=”http://www.company.com/cgi/script.pl">
• FORM contents consist primarily of INPUT tags, which • <input type="text" name="name" size="xx"
define the field types and the names of the variables. These maxlength="yy" value="default-value" />
INPUT tags allow the visitor to enter information or to
• Creates a single-line box for your user to place data. You
select choices.
can set the size, maximum length, and default values if
• Each INPUT tag is given a TYPE and NAME attributes. you wish.
These attributes determine what kind of information it
• Example:
contains and the name identifer for the field.
• This is the syntax for an input tag: Enter your first name: <input type="text"
<input type="option" name="text" /> name="firstname" size="40" maxlength="40"
value="Enter First Name" />
• Types available:
– Comments?
<textarea rows="3" cols="40" name="comments”
wrap="virtual">
Enter comments
</textarea>
Week 8 Slide 11 of 22 Week 8 Slide 12 of 22
6
<input
<input type=“radio” /> type=“checkbox” />
• Provides a group of buttons from which only one may be chosen • Works just like the radio button, except that more than one value can
be selected.
• <input type="radio" name="text" value="value" />
• <input type="checkbox" name="name" value="value" />
• If you want a radio button to be pre-selected, add the attribute
"checked". • Example:
<br /><input type="checkbox" name="computer" value="Mac" />Macintosh
• Example: <br /><input type="checkbox" name="computer" value="Unix"
<br /><input type="radio" name="univ" value="UCLA" />UCLA checked="checked" />Unix
<br /><input type="radio" name="univ" value="Harvard" />Harvard <br /><input type="checkbox" name="computer" value="Win98" />
Windows 98
<br /><input type="radio" name="univ" value="Oxford" />Oxford
<br /><input type="checkbox" name="computer" value="Win2k" />
<br /><input type="radio" name="univ" value="Stanford"
Windows 2000
checked="checked" />Stanford
• This choice allows the user to reset and clear all of the data • The submit value displays a push button with the
fields to their default values. preset function of sending the data in the form to
the server to be processed, as defined by the action
• <input type="reset" value="text" />
attribute in the <form> tag.
• Whatever is put in the text for the value attribute will be
• <input type="submit" value="text" />
what is seen as the Reset button.
• Whatever is put in the text for the value attribute
<input type="reset" value="Clear all choices
will be what is seen as the Submit button.
and start over again" />
<input type="submit" value="Click here
to submit your choices" />
9
<input type=“image” /> <input type=“button” />
• Sometimes, designers wish to create their own • Sometimes you'll want to create a webpage that will
submit button using a graphical program. The do an action but won't submit the entire data. For
image value works exactly the same way the submit example, you might create a Javascript program to
value works. The SRC attribute defines the URL of calculate the shipping cost or the tax of a potential
the image; the ALT attribute will be displayed if the order. Whatever is placed in the value attribute will
browser is incapable of displaying images; the be displayed as the button; the name will be the
width and height attributes define the width and name called by the script.
height of the image; the border attribute defines
• <input type="button" value="text" name="name" />
whether a border is desired.
• This requires the use of a scripting language to tie
• <input type="image" src="URL-of-image" alt="text"
an event to the button and create an action.
width="xx" height="yy" border="0" />
• <input type="button" value="Calculate
• <input type="image"
Interest" name="calculator" />
src="http://www.company.com/images/
clickme.gif" alt="Click Me to Submit"
width="30" height="10" border="0" />
Part=Widget&Qty=3&Name=John+Doe&ID=694
ID: 694
Order Form
Part Widget
Qty 3
Hidden
Name: John Doe
ID: 694
Week 8 Slide 21 of 22
Client Week 8 Slide 22 of 22
11
Web Site Design Week 9
Stanford University Continuing Studies CS
21
• Frames
• Internal Links
• Meta Tags
Mark Branom markb@stanford.edu
http://www.stanford.edu/people/markb/
• Web site hosting and setting up
Course Web Site: a domain name
http://www.stanford.edu/group/csp/cs21
1st frame
2nd frame
simpleframe.html
http://www.stanford.edu/group/csp/cs21/simpleframe/simpleframe.html
f1.html
f2.html
f3.html
5
Nesting frames Nesting Frames example
http://www.stanford.edu/group/csp/cs21/nested/nested.html
• Just as you can nest tables to
control page layout, you can
also nest frames.
• If you choose to nest, be aware
of the potential confusion for
your viewers -- think about
making only one frame change.
• Be sure to name each frame so
you can target where the links
are going.
nested.html
home.html
nf1.html
7
Source codes (cont.) Source codes (cont.)
faq.html
contact.html
new.html
Week 9 Slide 15 o
f 29 Week 9 Slide 16 of 29
8
Using frames in a site Noframes
– Frame A loads into Frame B and <h1 align="center">This site uses frames.
<a href="home.html">
</a>
</h1>
</body>
</noframes>
• A main use of the meta tag is to • Webmasters also use meta tags to force
browsers to show current pages, rather than
force the browser to open a new viewing them from the cache.
page in a different location (or to
<meta http-equiv="Expires"
refresh an existing page after a set content="0" />
number of seconds). • Causes browser to NEVER view the
page in the cache
• http://www.internic.net/alpha.html
15