HTML New
HTML New
HTML
Markup Languages
Traditional vs. Hyperlinked Document Pages
Markup Languages
Source: Schneider and
Markup Languages and the Web
Standard Generalized Markup Language (SGML) SGML is a
system for defining markup languages. A system for
organizing and tagging elements of a document.
HTML is one example of a markup language. Each markup
language defined in SGML is called an SGML application.
What's Special about SGML?
its emphasis on descriptive rather than procedural markup;
its document type concept; and
its independence of any one system for representing the script in
which a text is written.
Regulated ISO standard since 1986
Nonproprietary
Supports user-defined tags
Markup Languages
Markup Languages and the Web
Hypertext Markup Language (HTML)
Based on SGML
Easier to learn and support
Supports commonly used text markup features
Headings, title bars, bullets, lines, lists
Precise graphic positioning, tables, and frames
Standard language for Web pages
Markup Languages
XML & HTML
XML was designed to describe data and
to focus on what data is.
HTML was designed to display data and
to focus on how data looks.
Markup Languages
Hypertext & HTML
Hypertext Markup Language (HTML) is the
language for specifying the content of Web pages
hypertext refers to the fact that Web pages are more
than just text
can contain multimedia, provide links for jumping within &
beyond
markup refers to the fact that it works by augmenting
text with special symbols (tags) that identify structure
and content type
Markup Languages
Hypertext & HTML
HTML is an evolving standard (as new
technology/tools are added)
HTML 1 (Berners-Lee, 1989): very basic, limited integration of
multimedia
in 1993, Mosaic added many new features (e.g., integrated images)
HTML 2.0 (IETF, 1994): tried to standardize these & other features,
but late
in 1994-96, Netscape & IE added many new, divergent features
HTML 3.2 (W3C, 1996): attempted to unify into a single standard
but didn't address newer technologies like Java applets & streaming video
HTML 4.0 (W3C, 1997): current standard
attempts to map out future directions for HTML, not just react to vendors
Markup Languages
Hyperlink Structures
Markup Languages
HTML Advanced Features
HTML layout
HTML Fonts
HTML Styles
HTML Head
HTML Meta
HTML URLs
HTML Scripts
HTML Web Server
Markup Languages
HTML
Tags & elements
Tags
<HTML>
<body>
<h1> to <h6>
<p>
<br>
<hr>
<!..>
Markup Languages
Programming in HTML
Type tags into a text file (Notepad)
HTML editor
HTML code must be saved with .html extension/
Explorer interpret tags to make the page layout
Markup Languages
Tags vs. Elements
HTML specifies a set of tags that identify structure
and content type
tags are enclosed in < >
<img src="image.gif"> specifies an image
most tags come in pairs, marking a beginning and ending
<title> and </title> enclose the title of a page
HTML Tags not case-sensitive
Lower-case tags recommended
HTML Tags may contain attributes
Can nest tags
Tags cannot overlap
Markup Languages
Tags vs. Elements
An HTML element is an object enclosed by a pair of tags
Markup Languages
Structural Elements
an HTML document has
two main structural Add content
elements between
HEAD contains setup <BODY> …
information for the </BODY>
browser & the Web page
e.g., the title for the browser Text Structure Tags
window, style definitions,
JavaScript code, … Headings
BODY contains the actual Paragraphs
content to be displayed in Lists
the Web page
Images
Markup Languages
HTML: Document Tags
<HTML> … </HTML>
Beginning and end of every HTML document
<HEAD> … </HEAD>
Contains information about the document
including the title that is to appear in the title bar
<TITLE> … </TITLE>
Causes the page title to be displayed in the title
bar
<BODY> … </BODY>
All content for the page is placed between these
tags
Markup Languages
A Very Simple HTML Program
<H1>Theatre Schedule</H1>
Markup Languages
Example
<HTML>
<HEAD>
<TITLE>Joe’s Home Page</TITLE>
</HEAD>
<BODY>
<H1>Welcome to Joe’s Home Page</H1>
…Blah-Blah-Blah
</BODY>
<HTML>
Markup Languages
HTML Text Tags: Paragraph Tag
<P> … </P>
Blank line inserted before the start of the paragraph
One space between adjacent words regardless of the
number of spaces in the source
Extra spaces and lines are ignored
Markup Languages
Alignment
Align headings and text with the ALIGN command
left, center, and right justify a heading
<H1 ALIGN=LEFT>Joe’s home page</H1>
<H1 ALIGN=CENTER>Joe’s home page</H1>
<H1 ALIGN=RIGHT>Joe’s home page</H1>
left, center, and right justify a paragraph
<P ALIGN=LEFT>imagine a BIG paragraph in here</P>
<P ALIGN=CENTER> imagine a BIG paragraph in here </P>
<P ALIGN=RIGHT> imagine a BIG paragraph in here </P>
note that the </P> is used here to end the paragraph and turn off the
alignment
Markup Languages
HTML Text Tags:
Line Break Tag & Dividing Lines
<BR>
Forces a new line
Markup Languages
HTML Formatting
Markup Languages
Other Text Tags
<BLOCKQUOTE> </BLOCKQUOTE>
Indented text
Preformatted Text
<PRE></PRE>
Text is formatted exactly as typed
Can be used for simple tables
Can be used as a substitute for tabs
Markup Languages
HTML LISTS
An unordered List Tags
An ordered List <ul>- Define an unordered list
Definition List <ol>- Define an ordered list
Nested List <li> - Define a list item
<dl>- Define a definition list.
<dt> - Define a definition term
<dd>- Define a definition description
Markup Languages
Creating Lists
Unordered Lists: Unordered (bulleted) lists <UL> can use a disc,
circle, or square
<h4>An Unordered List:</h4>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Output:
An Unordered List:
• Coffee
• Tea
• Milk
Markup Languages
Ordered Lists
Ordered (numbered) lists <OL> Progarm
can use numbers (1), capital <ol>
letters (A), lowercase letters (a), <li>Coffee</li>
or Roman numerals (i) <li>Milk</li>
<OL TYPE=1 START=5> </ol>
<LI>first line
Output
<LI>second line ... 1. Coffee
</OL> 2. Milk
<UL TYPE=circle> Additional
<LI>first line ... <ol type="A">
</UL> <ol type="a">
All lists use <LI> to specify a <ol type="I">
new line <ol type="i">
Markup Languages
Nested Lists
<h4>A nested List:</h4>
A nested List:
<ul>
Coffee
<li>Coffee</li>
Tea
<li>Tea Black tea
<ul> Green tea
<li>Black tea</li> Milk
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
Markup Languages
Definition Lists
Markup Languages
Fonts
Font Size
Base font size (default=3, range = 1-7; 1=smallest,
7=largest)
<BASEFONT SIZE=5>
Font size
<FONT SIZE=3> sets font size to 3
Relative font size
<FONT SIZE=+1> increases font size by 1
<FONT SIZE=-2> decreases font size by 2
<big>… </big> increase the size of the font
<small>… </small> decrease the size of the font
LINKS
Tag <a>
Markup Languages
HTML Link Tag
Link to
Other sites
Between your own pages
To e-mail
<A HREF=“name”>hypertext</A>
<A HREF=“http://www.kodak.com”>Kodak</A>
<A HREF=“john/johnpage.html”>John’s Page</A>
<A HREF=“mailto:[email protected]”>John’s mail</A>
<A HREF=“file:///C:\web\john\johnpage.html”>John’s Page</A>
Markup Languages
Text Hyperlinks
Text links
use <A HREF=“…”> to link to another HTML page
HREF points to new page
text between <A…> and </A> will be highlighted as a
link, e.g., “click here for syllabus” below will be
highlighted
<A HREF=“http://cis519dhm.bus.umich.edu”>
click here for syllabus
</A>
Markup Languages
Linking within one document
<p> <a href="#C4"> See also Chapter 4.
See also Chapter 4. </a> </p> Chapter 1
<p> <h2>Chapter 1</h2> This chapter explains ba bla bla
<p>This chapter explains ba bla Chapter 2
bla</p>
This chapter explains ba bla bla
<h2>Chapter 2</h2> <p>This
chapter explains ba bla bla</p> Chapter 3
This chapter explains ba bla bla
<h2>Chapter 3</h2> <p>This Chapter 4
chapter explains ba bla bla</p> This chapter explains ba bla bla
Chapter 5
<a name="C4"><h2>Chapter This chapter explains ba bla bla
4</h2></a> <p>This chapter
explains ba bla bla</p>
<h2>Chapter 5</h2> <p>This
chapter explains ba bla bla</p>
Markup Languages
Link to a mail
<p> This is a mail link: This is a mail link: Send Mail
<a href="mailto:someone@ Note: Spaces between words
microsoft.com?subject=Hello should be replaced by %20 to
%20again">
ensure that the browser will
Send Mail</a> </p>
display your text properly.
<p>
<b>Note:</b> Spaces between
words should be replaced by %20 to
<b>ensure</b> that the browser will
display your text properly.
</p>
Markup Languages
HTML Images
<img> Defines an image
Attributes:SRC, ALT, HEIGHT, WIDTH,
ALIGN, HSPACE ,VSPACE
Markup Languages
Image File Formats
Markup Languages
Image File Formats (cont’d)
Transparency
All bitmapped graphics are rectangular by nature.
Parts of a GIF image can be made transparent.
Transparency in layered in flat images.
Interlacing
Downloading in a series of passes.
With each pass, the image becomes clearer.
Useful for slow Internet connections.
Animation
A sequence of frames.
All frames saved as a single animated GIF file.
Markup Languages
HTML Image Tag
Markup Languages
Inserting Image from Other Location
Markup Languages
ALT Attribute & Sizing Graphics and borders
Sometimes graphics may not be WIDTH and HEIGHT
shown. specify graphic size in
The ALT attribute of the IMG pixels
<IMG
tag specifies an alternate text
SRC=“MyPicture.gif”
display for non-graphic WIDTH=150
browsers HEIGHT=200>
<IMG BORDER specifies
SRC=“JoesPicture.gif” width of border in pixels
<IMG
ALT=“[Picture of Joe and SRC=“MyPicture.gif”
his dog.]”> BORDER=14>
Markup Languages
ALIGN Attribute & HSPACE
The attribute HSPACE
Used to specify the provides some horizontal
relation of text to the padding around the text so that
image. the text and image do not butt
up against each other.
<IMG SRC=“image”
<IMAGE SRC=“image”
ALIGN=“direction”> HSPACE=20 This is the
Default is bottom descriptive text>
Attribute values: top, Also the attributes VSPACE
middle, bottom, right, and SPACE
left
Markup Languages
HTML Back Ground
Markup Languages
Background Color / Graphics
Backgrounds can be added to each document, but are not readable
on all browsers.
Attributes of <BODY>
BGCOLOR=”code” Specify color for background of the screen
BACKGROUND=”path/file” Tiles the graphic in the file to fit the screen
<BODY BGCOLOR=”green”>
<BODY BGCOLOR=”#00FF00”>
<BODY BACKGROUND=” BrickWall.gif”>
black is “000000” (i.e., no color)
white is “ffffff”
Markup Languages
Creating Tables
<TABLE BORDER> starts table including a border
<CAPTION ALIGN=top> add title at top
<TR> starts a new table row
<TH> adds the headers for a table
<TD> adds the data for a table
<table> Defines a table
<caption>Defines a table caption
<colgroup>Defines groups of table columns
<col>Defines the attribute values for one or more columns in a
table
<thead>Defines a table head
<tbody>Defines a table body
<tfoot>Defines a table footer
see next page for example format
Markup Languages
Example: Tables
Markup Languages
Table example
Tables (continued)
<TABLE BORDER>
<CAPTION ALIGN=top>Joe’s Resume</CAPTION>
<TR>
<TH>Year</TH><TH>Company</TH><TH>Position</TH>
</TR>
<TR>
<TD>1995</TD><TD>Microsoft</TD><TD>Manager</TD>
</TR>
<TR>
<TD>1994</TD><TD>Microsoft</TD><TD>Programmer</TD>
</TR>
</TABLE>
Markup Languages
HTML FRAMES
Markup Languages
Advanced HTML: Frames
Header
Frames
Menu
divides screen into sections
allows one section to control Body
another
often used with a fixed header,
menu, and body
Markup Languages
Example: Framed Page
Markup Languages
<html>
<frameset cols="25%,40%,25%,
10%">
<frame src="tryhtml_frame_a.htm">
<frame src="tryhtml_frame_b.htm">
<frame src="tryhtml_frame_c.htm">
<frame src ="tryhtml_frame_d.htm">
</frameset>
</html>
Markup Languages
Vertical frames
<html>
<frameset cols="25%,40%,25%, 10%">
<frame src="tryhtml_frame_a.htm">
<frame src="tryhtml_frame_b.htm">
<frame src="tryhtml_frame_c.htm">
<frame src ="tryhtml_frame_d.htm">
</frameset>
How to have Horizontal Frames?
/html>
Markup Languages
Mixed Frames
<html>
<frameset rows="50%,50%">
<frame src="tryhtml_frame_a.htm">
<frameset cols="25%,75%">
<frame src="tryhtml_frame_b.htm">
<frame src="tryhtml_frame_c.htm">
</frameset>
</frameset>
</html>
Markup Languages
Advanced HTML: Frames
Used to display more that one HTML document in the
same browser window.
Setting up frames
Create an extra HTML file
<frameset> & <noframes> (noframes optional)
Attributes = rows OR cols
example:
<frameset cols=“25%, 75%”>
<frame src=“frame1.htm>
<frame src=“frame2.htm>
</frameset>
<noframes>
<body>Frames Reqd!</body>
</noframes>
Markup Languages
HTML Forms
<form>Defines a form for user input
<input>Defines an input field
<textarea>Defines a text-area (a multi-line text
input control)
<label> Defines a label to a control
<fieldset>Defines a fieldset
<legend>Defines a caption for a fieldset
<select>Defines a selectable list (a drop-down box)
<optgroup>Defines an option group
<option>Defines an option in the drop-down box
<button>Defines a push button
Markup Languages
Text Fields
<html> <body> <form>
First name: <input type="text" name="firstname">
<br> Last name: <input type="text" name="lastname">
</form>
</body>
</html>
<form>
Username:
<input type="text" name="user">
<br>
Password:
<input type="password" name="password">
</form>
Markup Languages
Advanced HTML: Forms
Forms can provide input for dynamic content
CGI, MOD, ASP (coming soon…)
Form tags
<form action=“run.cgi”> … </form>
Input tags
type, name and value fields
type = type of input (checkbox, radio, text)
name = name of the input field
value = default value
Also: <textarea>, <select>, <button>
Submit
<input type=Submit value="Submit">
Markup Languages
Tables for Layout
Potential Uses:
Advanced Text Layout
Vertical spacing
However, height attribute not official HTML 3.2
Multiple columns of Text
Using 2 cols
Sophisticated Table Borders
Using “table-within-a-table”
Making your page the same at all resolutions and on all
browsers
Experiment with no border tables and alignment, cell-
padding and cell-spacing
Markup Languages
Advanced HTML: Inserting Scripts
…
</head>
<body>
…
<script language="JavaScript"> document.write("Hello
World!")
</script>
…
</body>
</html>
Markup Languages