Authoring Web Pages
Introduction
The purpose of this document is to show you how to create simple Web pages. For example, you could create a Web page on your computer that enables your students to click user-friendly names to access sites, rather than type long addresses.
Web pages consist of text, so you can use any text editor to create and modify them. On Windows, you can use Wordpad or Notepad. (Wordpad and Notepad are both available under Start/All Programs/Accessories.) On Macintosh systems, you can use SimpleText or TextEdit. To create a simple Web page that consists of a list of links:
- Copy the text below by highlighting it and clicking Control-C on a Windows computer or Command-C on a Macintosh.
- Open a new text document with your text editor of choice: Wordpad, Notepad, TextEdit, etc.
- Paste the text you copied into the new text document.
- Modify the text for your pages by entering an appropriate title, a heading between the <h1> and </h1> tags, and Web addresses and user-friendly names. This sample page has a list of five links. If you don't use them all, you can delete a link by deleting one of the lines that begins with <li>. If you need more links, just duplicate this line and modify it.
- Tip: You can copy and paste URL addresses. Open a Web browser, navigate to the page to which you want to create a link, then click once in your browser's address bar to highlight the address. Copy the address (Control-C or Command-C), then switch to your text editor and paste the copied text between the quotation marks that follow href=.
- Save your text document as a text file with an htm or html extension; e.g., mathlinks.htm.
- Double-click your new HTML file and test it by clicking the links. Your browser should take you to those pages.
Best Practices
- Use plenty of whitespace in your code. Browsers ignore extra whitespace when they render the page, but it will make your code easier to read and maintain.
- Don't use spaces in filenames.
- Use all lower-case letters in filenames.
- Use JPEG, GIF, or PNG graphics. Don't use BMP images.
- Use relative references to documents, images, and other files within your Website.
- Use absolute references when you link to documents on other Websites.
- If you use frames, be sure to use a target="_blank" attribute when you link to a document on another Website. Otherwise, the document will appear within your frame, making it look like you authored it.
- Don't use tables for layout. This confuses the software that blind persons use to read Web pages aloud.
- Always use an alt attribute when you insert an image.
- Don't use the img height and width attributes to resize images. Use an image editor instead.
- It is rude to play sounds automatically when your Web page loads.
- To add sound to a Web page, consider an MP3 podcast. Don't use a proprietary sound format, such as WAV.
- GIF animations went out of style in the 1990s. They also give some people headaches.
- Background images can be very attractive and useful, or very ugly and distracting.
- Human beings have been reading text printed on a plain background for several thousand years. Rebel against that practice at your own risk.
- Never use Microsoft Word to create a Web page. It makes a mess. If you have Word files or other heavily formatted documents that need to be converted for Web use, consider putting them in Adobe Acrobat format.
- Never use an <h2> tag without a preceding <h1> tag. HMTL heading tags are used to define the structure of your document. It's like an outline.
- All caps are fine if you are designing road signs. Stick with upper- and lower-case on Web pages and printed documents.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Type the title of your page here</title>
</head>
<body>
<h1>Type the heading for your page here</h1>
<ul>
<li><a href="URL goes here">Put a user-friendly name here</a></li>
<li><a href="URL goes here">Put a user-friendly name here</a></li>
<li><a href="URL goes here">Put a user-friendly name here</a></li>
<li><a href="URL goes here">Put a user-friendly name here</a></li>
<li><a href="URL goes here">Put a user-friendly name here</a></li>
</ul>
</body>
</html>
As you can see from the sample above, an HTML page consists of the text that appears on the page, along with tags that are enclosed within less than (<) and greater than (>) brackets. Your browser uses these tags to format the page. Note that the opening and closing tags are identical, except that the closing tag contains a forward slash (/).
The purpose of HTML tags is to identify the function of text, not its appearance. Thus the <h1> tag in the sample above indicates a Heading 1, or highest-level heading, in your document. The appearance of h1-level text is determined by your browser's default settings or, as in the case of the page you are reading, by a stylesheet. It is possible to enter HTML tags that change the appearance of a document, but this is not a smart practice. HTML pages can be viewed on a variety of devices; attempting to hard-code their appearance can create problems when they are viewed on devices other than the one on which you created them. If you are interested in controlling the appearance of your Web pages, I suggest you use Cascading Stylesheets to accomplish this.
The Filename Extension Problem
The designers of both Windows and Macintosh computers assume that users don't know how to manage filename extensions. By default, Windows systems hide filename extensions from the user, so when you use Wordpad or Notepad to create a text file named mathlinks.htm, it actually creates a file named mathlinks.htm.txt. If you double-click that file, Windows will open it with Notepad, which is the registered program for files with a txt extension. To prevent this on Windows systems, you can put the filename inside quotes; e.g., "mathlinks.htm". You can eliminate this problem once and for all by doing the following:
- Open Windows Explorer (click Windows-E or click Start/Programs/Accessories, or just Start/Programs, depending on your version of Windows.
- Click Tools/Folder Options.
- Click the View Tab.
- Uncheck the box beside "Hide extensions for known file types."
- Click the Apply to All Folders button. (This may be slightly different, depending on your version of Windows.)
If you create a filename with an extension under Macintosh OS X, the Mac will note that the filename appears to have an extension and ask if you want to append another one. Say no.
HTML Tips
- Name your home page default.htm, default.html, index.htm, or index.html. This enables users to retrieve your page without having to type its full URL. For example, a user can retrieve the home page for Atkins Elementary School by entering http://www.scsb.org/aes/ if the school's home page is named default.htm.
- Use lowercase letters for all filenames. Windows Web servers are not case-sensitive, but Unix and Linux Web servers are. On a Windows system, myfile.htm and MyFile.htm are the same file. On Unix and Linux Web servers, they are not. The majority of Web servers are Linux and Unix.
- Don't use spaces in your filenames. The following link points to a non-existent file that has a space in its name. When you click it, your browser will display a Page 404 (file not found) error. Please note the weird characters your browser has to insert in place of the spaces. file name with spaces
- Please place your images in a subdirectory called images. To link an image, use the following HTML syntax: <img src="images/mypicture.jpg">. Using an images subdirectory makes your site easier to maintain.
- Please use relative addressing for your internal links. If you are not sure of the difference between relative and absolute addressing, please contact Terry Hawthorne.
- Use banners sparingly. While it may look impressive to have text scrolling across the screen, remember that it is easier for your audience to read what you have to say if it is not moving around.
- If you use a colored background or background image, use a text color that contrasts strongly with the background.
- Use Cascading Style Sheets (CSS) to control colors, fonts, margins, borders, and other presentational information. All non-CSS presentational tags, such as bgcolor and font tags, are deprecated, meaning they will not be supported in future versions of HTML and XHTML.
- People visit your visit for information. A plain-looking site that has useful, frequently updated content will attract many more visitors than a site that is long on looks and short on content. The best sites look good and satisfy the audience's need for information.
- Don't needlessly retype information. For example, if your cafeteria staff or school secretary uses a word processor to create the weekly menus, get a copy of that file and copy and paste its contents into your Web page. The same goes for honor rolls and other school announcements.
- HTML elements and attributes should be lowercase and attribute values should be enclosed in quotes; e.g.:
<img src="images/mypicture.jpg" width="320" height="240" alt="Information about this picture" />
Note the /> at the end of the img tag. The next point provides the explanation.
- Every HTML element tag must have a corresponding closing tag; e.g.:
<p>This is a paragraph enclosed by opening and closing paragraph tags.</p>
- Tags that don't enclose content, such as line break (<br>), should be written as follows:
| Element | Form | Alternate Form |
| Line Break | <br/> | <br></br> |
Horizontal Rule | <hr/> | <hr></hr> |
Policies for Smyth County Schools Web Page Authors
Please observe the following guidelines when authoring Web pages that are to be posted
on the Smyth County School Board's World Wide Web server.
- Like newspapers, yearbooks, and other school publications, Web pages must be reviewed
and approved by the school principal or his designated staff member.
- Web pages may not include personal information on staff members and students. Personal
information includes, but is not limited to, phone numbers and addresses.
- Web pages should not include photographs of students accompanied by their names.
Common HTML Tags
The following table lists the commonly used HTML tags.
| Tag |
Purpose |
| html |
Used to mark the beginning of a Web page. |
| head |
Used to mark the beginning of the header section of a Web
page. |
| title |
Used in the header of a Web page to store the page's title,
which will appear in the title bar of your browser window. |
| body |
Used to mark the beginning of the body of a Web page. |
| h1 |
Used to identify and format the top-level heading in a
document. The headline of this Web page is formatted with an H1 tag. |
| h2-h6 |
Lower-level headings in a document. |
| p |
Used to mark the beginning of a new paragraph. |
| hr |
Used to insert a line, or horizontal rule. Because the hr tag does not enclose any content, you should write it as follows: <hr/>. |
| table |
Used to mark the beginning of a table. |
| tr |
Used to mark the beginning of a row in a table. |
| td |
Used to mark the beginning of a cell in a table. |
| ol |
Used to mark the beginning of a numbered list. |
| ul |
Used to mark the beginning of a bulleted list. |
| li |
Used to enclose individual list items in a numbered or
bulleted list. |
| a |
Used to insert a hyperlink. The full format is <a href="hyperlink
file">, where hyperlink file is the name of the file you are
linking to. For example, the following could be used to code a link to the
Smyth County School Board's calendar page:
Click <a href="http://www.scsb.org/calendar.html">here</a>
to view our calendar.
This produces:
Click here to view our calendar.
If the page you linking to is located on
the same Web server as the page that contains the link, it is a good
practice to eliminate the reference to the Web server, or the http://www.scsb.org
in our example. This enables you to move your Web pages from one computer
to another without having to recode your links. |
| img |
Used to insert an image. Remember that Web pages are text
files. You cannot insert pictures directly into Web pages. To have a
browser render a picture as part of a Web page, you insert a reference to
the picture. The full format is
<img src="picture filename"> where picture filename is
the name of the of the JPEG, GIF, or other picture file. Note that the img
tag does not have a closing form. |
Learning More
- Getting Started With HTML
- Advanced HTML Features
- Controlling Appearance With CSS
- A Complete List of HTML Character Entities (Character entities enable you to produce special characters: Α Ω ← √ ♥ ¢ © ®, etc.)
- User-Friendly XHTML Character Entities
- The Firefox browser is an essential tool for web developers. It enables you to preview your pages in a standards-based browser and provides additional add-on tools that are useful for Web developers, such as Firebug.
- What program should you use to write HTML? Any program that can generate plain text files will work. You can use Notepad and Wordpad on Windows computers, and SimpleText or TextEdit on Macintosh computers. The freeware program NoteTab Light is an excellent HTML editor. You can also use any word processing program, such as Microsoft Word, as long as it can save files in plain text format. Note that Microsoft Word has an option to save a document as a Web pages under its File Menu. This works, but it will generate an extremely large and very messy HTML file, which may be inaccessible across dial-up Internet lines. Microsoft FrontPage and Macromedia DreamWeaver are dedicated HTML authoring programs. I'm not familiar with DreamWeaver. FrontPage works OK, except that some of the code it generates only works on Internet Explorer. If you don't understand HTML, relying strictly on FrontPage can cause problems for you. If you want an open-source, graphical HTML authoring tool, consider Amaya, the World Wide Web Consortium's standards-based Web editor and browser.
- XAMPP for Windows, which provides a complete, easy-to-install Web development environment for a Windows computer. XAMPP includes the Apache web server, MySQL database, and the PHP programming language. These open-source, free tools can be used to create complex, interactive websites. If you are ready to move beyond static web pages, XAMPP provides all the tools you need, except an image editor and audio editor. Please continue reading to learn how to get those tools at no cost.
- GIMP (The GNU Image Manipulation Program) is a free, open-source image editor that is nearly as powerful as Adobe Photoshop. Carey Bunks has written a comprehensive book about GIMP, which is available online. paint.net is a free, Windows-only image editor. Both are adequate for creating and editing Web graphics.
- Audacity is an open-source sound editor. If you want to include audio podcasts on your web pages, you can use Audacity to record them, then encode them as MP3 files. Please note that Audacity does not include an MP3 encoder in its default installation; you need to download the LAME MP3 encoder separately and place it in Audacity's plug-ins folder after you install Audacity.
--By Terry Hawthorne