Date post: | 14-Apr-2017 |
Category: |
Documents |
Upload: | howard-stateman |
View: | 85 times |
Download: | 0 times |
Zero to Web in 60 minutes(a very basic HTML tutorial)
Howard Stateman
March 2009 Zero to Web in 60 Minutes 2
It’s A Text File
• Web Pages are text files– No Compiling, compression or encoding
• The file extension defines it– .html or .htm
• index.html or index.htm is your home page– Every subdirectory can have a home page
– .shtml .asp .php • For server-side pages • Out of the scope of this class
March 2009 Zero to Web in 60 Minutes 3
Build Your Own
• Open a new text document– Notepad or wordpad (write) or vi– Save as "all files" with .html extension
• Use Word Processors at your own risk– But not in this class, please
• They add a ton of formatting code
• Double-click to open in browser– Save your changes, then hit "refresh"
March 2009 Zero to Web in 60 Minutes 4
Basic Syntax
• Commands are called tags• Tags begins with a <• Tags end with a >• Most tags are used in pairs:
<html> blah blah blah </html>• Tags are not case-sensitive
– <HTML> = <Html> = <htmL>
March 2009 Zero to Web in 60 Minutes 5
Your Basic Web Page
<html><head><title>Your window title goes here</title></head><body>Blah blah blah
</body></html>
March 2009 Zero to Web in 60 Minutes 6
HTML
• Stands for Hypertext Markup Language– Based on SGML
• A child of early UNIX nroff and troff print formatting languages
• You don’t want to know how old those are
• The <html> tag begins all web pages• The </html> tag ends all web pages• Nothing goes between <html> and <head>
March 2009 Zero to Web in 60 Minutes 7
<HEAD>
• Not required• Can contain a variety of items
– Window Title– META information and commands– Scripts– Comments
• Must end </head> before <body> tag
March 2009 Zero to Web in 60 Minutes 8
<BODY>
• <body> is required– All your content goes between
<body>and
</body>– Nothing goes between </body>and </html>
March 2009 Zero to Web in 60 Minutes 9
Arguments
• Many tags accept arguments<BODY>
can become<BODY bgcolor="red">
or<BODY background="images/myphoto.jpg">
March 2009 Zero to Web in 60 Minutes 10
A Few Useful Tags
• Text modifiers– <H1> through <H6>
• Headline sizes: H1 is biggest– <U>
• Underline– <B>
• Bold– <I>
• Italics
March 2009 Zero to Web in 60 Minutes 11
A Few More Useful Tags
• <STRIKE>– Strike-out (line through a word or sentence)
• <EM>– Emphasis– Bold, ital, etc. depends on browser & font
• <BLINK>– Makes text blink on and off– Highly annoying, not supported in all browsers
March 2009 Zero to Web in 60 Minutes 12
Comments
• <!--– begins a comment
• -->– ends a comment<!-- this is invisible -->
<!--Old code we are too insecure to nuke-->
March 2009 Zero to Web in 60 Minutes 13
<FONT>
• An improvement on <Hn> tags<FONT face="" color="" size=n>
For example:<FONT face="Arial" color="red" size=+2>blah</FONT>
You can also use the RGB color codes<FONT face="Roman" color=#FF00FF size=10>blah </FONT>
For a color chart, see http://www.howeird.com/colors.html
March 2009 Zero to Web in 60 Minutes 14
Paragraphs and Breaks
• HTML ignores CRLFs• In HTML, this:There once was a man named Big FredWho liked to pour jam on his headHis wife told him, "Honey""We’ll run out of money"Then she went shopping for bread
• Will come out like this: There once was a man named Big Fred Who liked to pour jam on his headHis
wife told him, "Honey""We’ll run out of money"Then she went shopping for bread
March 2009 Zero to Web in 60 Minutes 15
<P> and <B>
• Use <P> to begin a paragraph• Use <B> to insert CRLF<p>There once was a man named Big Fred<br>Who liked to pour jam on his head<br>His wife told him, "Honey"<br>"We’ll run out of money"<br>Then she went shopping for bread<p> next paragraph…
• <BR> is stand-alone (no </BR>)• <P> only requires </P> when it has arguments
– <P align=center>blah</P>
March 2009 Zero to Web in 60 Minutes 16
Links and Anchors
• <A>– Begins a URL link
• </A> ends the link<A href="http://www.motorola.com">Moto</a>Only "Moto" will appear on the page
To force the URL to pop up in another window:<A href=http://www.motorola.com
target="_blank">Moto</a>
Also try: target="one", target="two"
March 2009 Zero to Web in 60 Minutes 17
Images
• <IMG> is used to place images – A stand-alone tag (no </IMG>)– It accepts many arguments– Src
• Source (URL pointing to the image file)
– Height– Width– Align<IMG Src="images/my.jpg" height=320 align=center><IMG Src=http://www.motorola.com/images/logo.png>
March 2009 Zero to Web in 60 Minutes 18
Clickable Image<A href="http://www.motorola.com"> <IMG SRC="http://www.motorola.com/images/logo.png"> Moto Web Site</a>
Will be clickable, and look like this:
Moto Web Site
March 2009 Zero to Web in 60 Minutes 19
Lists
• <UL>– Unordered List– Bullets
• <OL>– Ordered List– Numbered
• <LI>– List Item
March 2009 Zero to Web in 60 Minutes 20
<UL><LI><OL><UL><LI>Item One<LI>Item Two<LI>Item Three</UL>
<OL><LI>Item One<LI>Item Two<LI>Item Three</OL>
•Item One•Item Two•Item Three
1. Item One2. Item Two3. Item Three
March 2009 Zero to Web in 60 Minutes 21
Tables
• <TABLE>– Begins a formatted table– Takes several arguments
• Bgcolor, text, width• border, cellspacing, cellpadding
– <TR>• Table Row
– <TH>, <TD>• Table Header, Table Data (column)
March 2009 Zero to Web in 60 Minutes 22
Basic Table<TABLE><TR><TH>Column One</TH><TH>Column Two</TH></TR><TR><TD>Item One</TD><TD>Item Two</TD></TR></TABLE>
March 2009 Zero to Web in 60 Minutes 23
Special Characters
• Two ways to call– Character Code (numeric)– HTML code (alpha)
• Begins with "&"• Ends with ";"• Use charmap for numeric code• See handout for alpha codes
March 2009 Zero to Web in 60 Minutes 24
Some Useful Characters
• < less than "<"• > greater than ">"• space " "• & ampersand "&" • é acute accent e "é"• ñ n with tilde "ñ"• C0; Pi "π"
March 2009 Zero to Web in 60 Minutes 25
Play Time
• <EMBED></EMBED>– Place audio/video in a player on page– Several arguments
• SRC• Height• Width• Autostart• Loop
March 2009 Zero to Web in 60 Minutes 26
<EMBED>Audio<EMBED src="http://www.howeird.com/sounds/fields1.mp3" autostart="true" loop="false" width=240 height=80></EMBED>
Video<EMBED src="video.wmv" autostart="true" loop="true"></EMBED>
March 2009 Zero to Web in 60 Minutes 27
Scrolling Text• <MARQUEE></MARQUEE>
– A fun tag to scroll text across the screen<MARQUEE><font face="papyrus" size=+3 color="brown">Wheeeeeeee!</font>
</MARQUEE>
<MARQUEE behavior="scroll" direction="up">
<font face="arial" size=+1 color="blue">Wheeeeeeee!</font>
</MARQUEE>
March 2009 Zero to Web in 60 Minutes 28
User Input
• CGI is beyond the scope of this class– Common Gateway Interface– HTML to Perl, C script
• <FORM>– Radio button– Checkbox– Text Box– Text field