Week 8: Intro to HTML: Building a Web Home Page
- Web Sites and HTML*
- *Hypertext Markup Language
What is HTML?
A language that allows you to create documents for the World Wide Web
You embed formatting instructions
Browsers interpret the instructions to display your formatting
What can you do with HTML?
Control how your text is presented
- Headings
- Paragraphs
- Numbered and bulleted lists
- Tables
Include Images
- Graphics
- Photos
Link to other pages or web sites
How does HTML Work?
Everything is done with "Tags"
"Container" tags work in pairs
A container tag "opens" an instruction: <title>
Another "closes" it: </title>
The instruction is applied to the text between the opening and closing tags:
- <title>Katz School of Business</title>
- Katz School of Business
appears in the title bar of the browser
How does HTML Work?
"Separator" tags work alone:
Examples:
- <p> paragraph break
- <br> line break
- <hr> horizontal line
- <li> adds a bullet or a number
Building a Web Page - 1
Start with the <html></html> tags:
Building a Web Page - 2
Insert the head and body tags:
- <html>
- <head>
- </head>
- <body>
- </body>
- </html>
Building a Web Page - 3
Add the title tags and a title:
- <html>
- <head>
- <title>This is the Title of the Web Page</title>
- </head>
- <body>
- </body>
- </html>
Building a Web Page - 4
Add some content between the body tags:
- <html>
- <head>
- <title>This is the Title of the Web Page</title>
- </head>
- <body>
- This web site is under construction...
- </body>
- </html>
- http://www.pitt.edu/~richfran/sample0.htm
Another Sample Web Page
<html> <!-- these are "comments" -->
<head> <!-- they won't appear in the browser -->
<title>Another Sample Web Page</title> <!-- the title appears in the Browser title bar -->
</head>
<center> <!-- everything will be centered until closing tag -->
<body bgcolor="#FFFFFF"> <!-- background color set to white -->
<h1>Another Sample Web Page</h1> <!-- h1 is the biggest heading -->
<h2>to illustrate some simple HTML formatting</h2><!-- h2 is the next biggest heading -->
</center> <!-- centering ends here -->
<hr> <!-- horizontal line -->
Just entering text causes it to be displayed in a simple manner. Regardless of where
you hit the enter key when typing, the browser will wrap the text according to how much
space there is.
<p> <!-- tag to force a new paragraph -->
You must use the paragraph tag to force a new paragraph.
<p>
There is a special tag that is used to create hyperlinks to other pages. This tag is
used here to refer to the <A HREF="http://www.pitt.edu">University of Pittsburgh</A>
home page.
</html>
http://www.pitt.edu/~richfran/sample1.htm
HTML Formatting: Headings
Organize document presentation
Use container tags: <h1>Your Text</h1>
Six levels <h1> through <h6>
- <h1>
produces largest font size
- down to <h6>
Closing a heading automatically produces a paragraph break
HTML Formatting: Headings
Sample HTML for headings:
- <html>
- <head>
- <title>Samples for Headings</title>
- </head>
- <body>
- <h1>Heading 1</h1><h2>Heading 2</h2>
- <h3>Heading 3</h3><h4>Heading 4</h4>
- <h5>Heading 5</h5><h6>Heading 6</h6>
- </body>
- </html>
- http://www.pitt.edu/~richfran/sample2.htm
HTML Formatting: Lists
Ordered Lists use container tags: <ol> </ol>
- produce numbers for list items
Unordered Lists use container tags: <ul> </ul>
- produce lists with bullets
List items go INSIDE the containers:
- <li>first item
- <li>second item
Line breaks are automatic
HTML Formatting: Lists
Sample HTML for lists:
- <html>
- <head>
- <title>Samples of Lists</title>
- </head>
- <body>
- Ordered List<ol>
- <li>first item<li>second item><li>third item</ol>
- Unordered List <ul>
- <li>first item<li>second item><li>third item</ul>
- </body>
- </html>
- http://www.pitt.edu/~richfran/sample3.htm
HTML Feature: Hyperlinks
HTML lets you refer to
- Other web pages
- Other Web Sites
Uses the <A></A> container tags
- Uses the URL (Uniform Resource Locator) as part of the HREF argument to the opening tag
- Places display text between the tags
- <A
HREF="http://www.pitt.edu">Pitt Home</A>
HTML Feature: Hyperlinks
- Sample HTML with Hyperlinks (in a List!)
- <html><head>
- <title>Sample of a Graphic Image</title>
- </head>
- <body
bgcolor="#ffffff"> <!-- background color set to white-->
- <center>
<!-- center on page -->
- <IMG
SRC="undercon.gif" ALT="webmaster in training">
- <p>
<!-- paragraph break -->
- <H2>Webmaster in Training</H2>
- </center>
- </body>
- </html>
- http://www.pitt.edu/~richfran/sample4.htm
HTML Feature: Graphics
You can include pictures or graphics in a page
Use the <IMG> tag (a separator tag)
This tag takes arguments
- SRC: (required) name of image file
- ALT: (optional) text to describe image
- ALIGN: (optional) to align with surrounding text
- other optional arguments
<IMG SRC="image.fil" ALT="a cool picture">
HTML Feature: Graphics
Sample HTML to include an image:
- <html><head>
- <title>Sample of a Graphic Image</title>
- </head>
- <body
bgcolor="#ffffff"> <!-- background color set to white-->
- <center>
<!-- center on page -->
- <IMG
SRC="undercon.gif" ALT="webmaster in training">
- <p>
<!-- paragraph break -->
- <H2>Webmaster in Training</H2>
- </center>
- </body>
- </html>
- http://www.pitt.edu/~richfran/sample5.htm
HTML Formatting Summary
Tags control formatting:
- container tags like <title></title>
- separator tags like <br>
Headings
Lists
Hyperlinks
Graphics
Miscellaneous (paragraph & line breaks)
Next Class
Creating your own personal home page
Deploying your personal home page
- Using your Pitt UNIX account
- Make your personal web page accessible to the entire world-wide-web