Вы находитесь на странице: 1из 192

Higher Institute of Technology Ramadan Tenth Computer Sciences Department ----------------------------------------

Lecture Notes on

Internet Programming
Prepared by

Dr. Sayed Saber Talab


Associate Professor of Computer Applications

Cairo, 2009

World Wide Web


The World Wide Web ("WWW" or simply the "Web") is a system of interlinked, hypertext documents that runs over the Internet. With a Web browser, a user views Web pages that may contain text, images, and other multimedia and navigates between them using hyperlinks. The Web was created around 1990 by the Englishman Tim Berners-Lee.

Basic terms
The World Wide Web is the combination of four basic ideas:

Hypertext: a format of information which allows, in a computer environment, one to move from one part of a document to another or from one document to another through internal connections among these documents (called "hyperlinks");

Resource Identifiers: unique identifiers used to locate a particular resource (computer file, document or other resource) on the network - this is commonly known as a URL or URI.

The Client-server model of computing: a system in which client software or a client computer makes requests of server software or a server computer that provides the client with resources or services, such as data or files; and

Markup language: characters or codes embedded in text which indicate structure, semantic meaning, or advice on presentation.

On the World Wide Web, a client program called a user agent retrieves information resources, such as Web pages and other computer files, from Web servers using their URLs. If the user agent is a kind of Web browser, it displays the resources on a user's computer. The user can then follow

hyperlinks in each web page to other World Wide Web resources, whose location is embedded in the hyperlinks. It is also possible, for example by filling in and submitting web forms, to post information back to a Web server for it to save or process in some way. Web pages are often arranged in collections of related material called "Web sites." The act of following hyperlinks from one Web site to another is referred to as "browsing" or sometimes as "surfing" the Web. Although the English word worldwide is normally written as one word (without a space or hyphen), the proper name World Wide Web and abbreviation WWW are now well-established even in formal English.

How the Web works


Viewing a Web page or other resource on the World Wide Web normally begins either by typing the URL of the page into a Web browser, or by following a hypertext link to that page or resource. The first step, behind the scenes, is for the server-name part of the URL to be resolved into an IP address by the global, distributed Internet database. The next step is for an HTTP request to be sent to the Web server at that IP address, requesting the resource. In the case of a typical Web page, the HTML text is first requested and parsed by the browser, which then makes additional requests for graphics and any other files that form a part of the page in quick succession. This is the distinction between a single page view and the many hits or web requests that are often necessary to view the page. The Web browser then renders the page as described by the HTML, CSS and other files received, incorporating the images and other resources as necessary. This produces the on-screen 'page' that the viewer sees. Most Web pages will themselves contain hyperlinks to other relevant and informative pages and perhaps to downloads, source documents, definitions and other Web resources. Such a collection of useful, related resources, interconnected via hypertext links, is what has been dubbed a 'web' of information. Making it available on the Internet created what Tim Berners-Lee first called the World Wide Web in the early 1990s.

If the user returns to a page fairly soon, it is likely that the data will not be retrieved from the source Web server, as above, again. By default, browsers cache all web resources on the local hard drive. An HTTP request will be sent by the browser that asks for the data only if it has been updated since the last download. If it has not, the cached version will be reused in the rendering step. This is particularly valuable in reducing the amount of web traffic on the internet. The decision about expiration is made independently for each resource (image, stylesheet, JavaScript file etc., as well as for the HTML itself). Thus even on sites with highly dynamic content, many of the basic resources are only supplied once per session or less. It is worth it for any Web site designer to collect all the CSS and JavaScript into a few site-wide files so that they can be downloaded into users' caches and reduce page download times and demands on the server. There are other components of the Internet that can cache Web content. The most common in practice are often built into corporate and academic firewalls where they cache web resources requested by one user for the benefit of all. Some search engines such as Google also store cached content from Web sites. Apart from the facilities built into Web servers that can ascertain when physical files have been updated, it is possible for designers of dynamically generated web pages to control the HTTP headers sent back to requesting users, so that pages are not cached when they should not be for example Internet banking and news pages.

Web standards
At its core, the Web is made up of three standards: the Uniform Resource Identifier (URI), which is a universal system for referencing resources on the Web, such as Web pages;

the HyperText Transfer Protocol (HTTP), which specifies how the browser and server communicate with each other; and

the HyperText Markup Language (HTML), used to define the structure and content of hypertext documents.

Publishing Web pages


The Web is available to individuals outside mass media. In order to "publish" a Web page, one does not have to go through a publisher or other media institution, and potential readers could be found in all corners of the globe. Unlike books and documents, hypertext does not have a linear order from beginning to end. It is not broken down into the hierarchy of chapters, sections, subsections, etc. Many different kinds of information are now available on the Web, and for those who wish to know other societies, their cultures and peoples, it has become easier. When travelling in a foreign country or a remote town, one might be able to find some information about the place on the Web, especially if the place is in one of the developed countries. Local newspapers, government publications, and other materials are easier to access, and therefore the variety of information obtainable with the same effort may be said to have increased, for the users of the Internet. Although some Web sites are available in multiple languages, many are in the local language only. Additionally, not all software supports all special characters, and RTL languages. These factors would challenge the notion that the World Wide Web will bring a unity to the world. The increased opportunity to publish materials is certainly observable in the countless personal pages, as well as pages by families, small shops, etc., facilitated by the emergence of free Web hosting services.

Web browser
A web browser is a software application that enables a user to display and interact with text, images, and other information typically located on a web page at a website on the World Wide Web or a local area network. Text and images on a web page can contain hyperlinks to other web pages at the same or different websites. Web browsers allow a user to quickly and easily access information provided on many web pages at many websites by traversing these links. Web browsers available for personal computers include Microsoft Internet Explorer, Mozilla Firefox, Netscape, and Opera, in order of descending popularity (as of August 2006). Web browsers are the most commonly used type of HTTP user agent. Although browsers are typically used to access the World Wide Web, they can also be used to access information provided by web servers in private networks or content in file systems Opera, an innovative, speedy browser popular in handheld devices, particularly mobile phones, as well as on PCs in some countries was released in 1996 and remains a niche player in the PC web browser market. It is available on the Nintendo DS Lite and has been confirmed for Nintendo's Wii console. The Lynx browser remains popular for Unix shell users and with vision impaired users due to its entirely text-based nature. There are also several text-mode browsers with advanced features, such as w3m, Links (which can operate both in text and graphical mode), and the Links forks such as ELinks. While the Macintosh scene too has traditionally been dominated by Internet Explorer and Netscape, the future appears to belong to Apple's Safari which is based on Apple's WebKit layout engine, derived from the KHTML layout engine of the open source Konqueror browser. Safari is the default browser on Mac OS X. In 2003, Microsoft announced that Internet Explorer would no longer be made available as a separate product but would be part of the evolution of its Windows platform, and that no more releases for the Macintosh would be

made. However, more recently in early 2005, Microsoft changed its plans and released version 7 of Internet Explorer for Windows in October 2006.

Features
Different browsers can be distinguished from each other by the features they support. Modern browsers and web pages tend to utilize many features and techniques that did not exist in the early days of the web. As noted earlier, with the browser wars there was a rapid and chaotic expansion of browser and World Wide Web feature sets. The following is a list of some of the most notable features: HTTP and HTTPS HTML, XML and XHTML Graphics file formats including GIF, PNG, JPEG, and SVG Cascading Style Sheets (CSS) Digital certificates Bookmark manager Caching of web contents Support of media types via plugins such as Macromedia Flash and QuickTime Autocompletion of URLs and form data Tabbed browsing Pop-up advertisement blocker

Protocols and standards

Hypertext Transfer Protocol


Hypertext Transfer Protocol (HTTP) is a method used to transfer or convey information on the World Wide Web. Its original purpose was to provide a way to publish and retrieve HTML pages. Development of HTTP was coordinated by the World Wide Web Consortium and the Internet Engineering Task Force. HTTP is a request/response protocol between clients and servers. The originating client, such as a web browser, spider, or other end-user tool, is referred to as the user agent. The destination server, which stores or creates
7

resources such as HTML files and images, is called the origin server. In between the user agent and origin server may be several intermediaries, such as proxies, gateways, and tunnels. An HTTP client initiates a request by establishing a Transmission Control Protocol (TCP) connection to a particular port on a remote host (port 80 by default; see List of TCP and UDP port numbers). An HTTP server listening on that port waits for the client to send a request message. Resources to be accessed by HTTP are identified using Uniform Resource Identifiers (URIs) (or, more specifically, URLs) using the http: or https URI schemes. Web browsers communicate with web servers primarily using HTTP (hypertext transfer protocol) to fetch webpages. HTTP allows web browsers to submit information to web servers as well as fetch web pages from them. The most commonly used HTTP is HTTP/1. Pages are located by means of a URL (uniform resource locator), which is treated as an address, beginning with http: for HTTP access. Many browsers also support a variety of other URL types and their corresponding protocols, such as ftp: for FTP (file transfer protocol), rtsp: for RTSP (realtime streaming protocol), and https: for HTTPS (an SSL encrypted version of HTTP). The file format for a web page is usually HTML (hyper-text markup language) and is identified in the HTTP protocol. Most browsers natively support a variety of formats in addition to HTML, such as the JPEG, PNG and GIF image formats, and can be extended to support more through the use of plugins. The combination of HTTP content type and URL protocol specification allows web page designers to embed images, animations, video, sound, and streaming media into a web page, or to make them accessible through the web page. Early web browsers supported only a very simple version of HTML. The rapid development of proprietary web browsers led to the development of non-standard dialects of HTML, leading to problems with Web interoperability. Modern web browsers support standards-based HTML and XHTML, which should display in the same way across all browsers. Internet Explorer does not fully support HTML 4.01 and XHTML 1.x yet. Currently

many sites are designed using WYSIWYG HTML generation programs such as Macromedia Dreamweaver or Microsoft Frontpage. These often generate non-standard HTML by default, hindering the work of the W3C in developing standards, specifically with XHTML and CSS (cascading style sheets, used for page layout).

Website
A website (or Web site) is a collection of web pages, typically common to a particular domain name or subdomain on the World Wide Web on the Internet. A web page is a document, typically written in HTML, that is almost always accessible via HTTP, a protocol that transfers information from the website's server to display in the user's web browser. All publicly accessible websites are seen as constituting a mammoth "World Wide Web" of information. The pages of a website will be accessed from a common root URL called the homepage, and usually reside on the same physical server. The URLs of the pages organize them into a hierarchy, although the hyperlinks between them control how the reader perceives the overall structure and how the traffic flows between the different parts of the sites. The first on-line website appeared in 1991. On 30 April 1993, CERN announced that the World Wide Web would be free to anyone. A copy of the original first Web page, created by Tim Berners-Lee, is kept here.

Overview
A website may be the work of an individual, a business or other organization and is typically dedicated to some particular topic or purpose. Any website can contain a hyperlink to any other website, so the distinction between individual sites, as perceived by the user, may sometimes be blurred. Websites are written in, or dynamically converted to, HTML (Hyper Text Markup Language) and are accessed using a software program called a Web browser, also known as an HTTP client. Web pages can be viewed or
9

otherwise accessed from a range of computer based and Internet enabled devices of various sizes, including desktop computers, laptop computers, PDAs and cell phones. A website is hosted on a computer system known as a web server, also called an HTTP server, and these terms can also refer to the software that runs on these system and that retrieves and delivers the Web pages in response to requests from the website users. Apache is the most commonly used Web server software (according to Netcraft statistics) and Microsoft's Internet Information Server (IIS) is also commonly used.

Types of websites
There are many varieties of Web sites, each specialising in a particular type of content or use, and they may be arbitrarily classified in any number of ways. A few such classifications might include: Affiliate: enabled portal that renders not only its custom CMS but also syndicated content from other content providers for an agreed fee. There are usually three relationship tiers. Affiliate Agencies (e.g. Commission Junction), Advertisers (e.g. Ebay) and consumer (e.g. Yahoo). Combinations exist (e.g. Adbrite).

Archive site: used to preserve valuable electronic content threatened with extinction. Two examples are: Internet Archive, which since 1996 has preserved billions of old (and new) Web pages; and Google Groups, which in early 2005 was archiving over 845,000,000 messages posted to Usenet news/discussion groups.

Blog (or web log) site: site used to log online readings or to post online diaries, which may include discussion forums (e.g. blogger, Xanga).

Business site: used for promoting a business or service.

Commerce site or eCommerce site: for purchasing goods, such as Amazon.com.

10

Community site: a site where persons with similar interests communicate with each other, usually by chat or message boards, such as MySpace.

Database site: a site whose main use is the search and display of a specific database's content such as the Internet Movie Database or the Political Graveyard.

Development site: a site whose purpose is to provide information and resources related to software development, Web design and the like.

Directory site: a site that contains varied contents which are divided into categories and subcategories, such as Yahoo! directory, Google directory and Open Directory Project.

Download site: strictly used for downloading electronic content, such as software, game demos or computer wallpaper.

Employment site: allows employers to post job requirements for a position or positions to be filled using the Internet to advertise world wide. A prospective employee can locate and fill out a job application or submit a rsum for the advertised position.

Game site: a site that is itself a game or "playground" where many people come to play, such as MSN Games and Pogo.com. Geodomain refers to domain names that are the same as those of geographic entities, such as cities and countries. For example, Richmond.com[1]is the geodomain for Richmond, Virginia.

Gripe site: a site devoted to the critique of a person, place, corporation, government, or institution.

Humor site: satirizes, parodies or otherwise exists solely to amuse.


Information site: contains content that is intended to inform visitors, but not necessarily for commercial purposes, such as: RateMyProfessors.com, Free Internet Lexicon and Encyclopedia.

11

Most government, educational and non-profit institutions have an informational site.


Mirror (computing) site: A complete reproduction of a website.

News site: similar to an information site, but dedicated to dispensing news and commentary. Personal homepage: run by an individual or a small group (such as a family) that contains information or any content that the individual wishes to include.

Phish site: a website created to fraudulently acquire sensitive information, such as passwords and credit card details, by masquerading as a trustworthy person or business (such as Social Security Administration, PayPal) in an electronic communication. (see Phishing).

Political site: A site on which people may voice political views.

Pornography (porn) site: a site that shows pornographic images and videos. Rating site: A site on which people can praise or disparage what is featured (e.g. ratemycar.com, ratemygun.com, ratemypet.com, and hotornot.com).

Review site: A site on which people can post reviews for products or services.

Search engine site: a site that provides general information and is intended as a gateway or lookup for other sites. A pure example is Google, and the most widely known extended type is Yahoo!. Shock site: includes images or other material that is intended to be offensive to most viewers (e.g. rotten.com and ratemypoo.com).

Web portal site: a website that provides a starting point, a gateway, or portal, to other resources on the Internet or an intranet. Wedsite: a website that details a couple's wedding event, often sharing stories, photos, and event information.

12

Wiki site: a site which users collaboratively edit (such as Wikipedia).

Some websites may be included in one or more of these categories. For example, a business website may promote the business's products, but may also host informative documents, such as white papers. There are also numerous sub-categories to the ones listed above. For example, a porn site is a specific type of eCommerce site or business site (that is, it is trying to sell memberships for access to its site). A fan site may be a vanity site on which the administrator is paying homage to a celebrity. Many business websites have the appearance of brochuresthat is, an advertisement that can be browsed around. Some websites act as vehicles for users to communicate with other people via Web chat. Websites are constrained by architectural limits (e.g. the computing power dedicated to the website). Very large websites, such as Yahoo!, Microsoft, and Google, employ many servers and load balancing equipment, such as Cisco Content Services Switches.

Hyperlink
A hyperlink (often referred to as simply a link), is a reference or navigation element in a document to another section of the same document, another document, or a specified section of another document, that automatically brings the referred information to the user when the navigation element is selected by the user. As such it is similar to a citation in literature, but with the distinction of automatic instant access. Combined with a data network and suitable access protocol, a computer can be instructed to fetch the resource referenced.

13

WEB PAGE
A web page or webpage is a resource of information that is suitable for the World Wide Web and can be accessed through a web browser. This information is usually in HTML or XHTML format, and may provide navigation to other web pages via hypertext links. Web pages may be retrieved from a local computer or from a remote web server. The web server may restrict pages to a private network, e.g. a corporate intranet, or it may publish pages on the World Wide Web. Web pages are requested and served from web servers using Hypertext Transfer Protocol (HTTP). Web pages may consist of files of static text within the web server's file system (static web pages), or the web server may read files of computer code that instruct it how to construct the (X)HTML for each web page when it is requested by a browser (dynamic web pages). Viewing a web page In order to view a web page, a web browser is needed. This is a type of software that can retrieve web pages from the Internet. During the initial creation of a web page, before it is uploaded to the web server, any text editor can view it. Viewing a web page in a text editor will display the source code, not the final product. Creating a web page To create a web page, a text editor or a specialized HTML editor is needed. In order to upload the created web page to a web server, traditionally an FTP client is needed. The design of a web page is highly personal. A design can be made according to ones own preference, or a pre-made web template can be used. Web Templates let web page designers edit the content of a web page without having to worry about the overall aesthetics. Many people publish their own web pages using products like Geocities from Yahoo, Tripod, or Angelfire. These web publishing tools offer free page creation and hosting up to a certain size limit.

14

Other ways of making a web page is to download specialized software, like a Wiki, CMS, or forum. These options allow for quick and easy creation of a web page which is typically dynamic. Saving a web page A local copy of a web page may be saved to one's computer, as long as no copyright laws are violated. Most GUI browsers will contain all the options for saving a web page. These include, but are not limited to: Saving the rendered text without formatting or images Hyperlinks are not identified, but displayed as plain text

Saving the HTML file as it was served - Overall structure will be preserved, although some links may be broken

Saving the HTML file and changing relative links to absolute ones - Hyperlinks will be preserved

Saving the entire web page - All images will be saved, as well as links being changed to absolute

Saving the HTML file including all images, stylesheets and scripts into a single MHTML file. This is supported by Internet Explorer, Mozilla and Mozilla Firefox. Mozilla and Mozilla Firefox only support this if the MAF plugin has been installed. An MHTML file is based upon the MHTML standard.

Common web browsers, like Mozilla Firefox and Internet Explorer, give the option to not only print the currently viewed web page to a printer, but optionally to "print" to a file which can be viewed or printed later. Some web pages are designed, for example by use of CSS, so that hyperlinks, menus and other navigation items, which will be useless on paper, are rendered into print with this in mind. Space-wasting menus and navigational blocks may be absent from the printed version; other hyperlinks may be shown with the link destinations made explicit, either within the body of the page or perhaps listed at then end. There are always rules to follow. For HTML, fortunately, the rules are few in number and what they offer is large...

15

This is just an introduction to some concepts behind HTML. After this lesson you will be able to: Express the importance of HTML standards Describe some of the differences between HTML 2.0, HTML 3.2, and HTML 4.0

HTML, or HyperText Markup Language, is how a web browser displays its multimedia documents. The documents themselves are plain text files (ASCII) with special "tags" or codes that a browser knows how to interpret and display on your screen. About those standards The World Wide Web is exciting. It is everywhere. It has exploded beyond everybody's expectations. Keep in mind that the thing that makes the Web (and the Internet in general) work are agreed-upon rules ("standards") that allow users of almost any kind of computer to be able to communicate and share information. Where does HTML fit into this? What we cover in this notes is aimed toward producing documents that comply with current HTML standards. By using "standard" HTML, your work is going to be most widely "shareable" in the fast changing future of the 'net. The early set of standards, known as HTML 2.0, are supported by nearly all web browsers. Things got somewhat more complicated with the features included in HTML 3.2 since Netscape and Microsoft have introduced many features that go beyond standard HTML, and were at first supported by certain web browsers. The web really took off in popularity during the time of the 3.2 standard. By its original design, HTML was not designed as a formatting tool, yet people have found ways (some might say "tricks") to attempt to use HTML for precise web page formatting. The current set of proposed standards is HTML 4.0 which contain more features for HTML and some attempts to reduce the complexities of different web browsers. This version is starting to move towards a more
16

"logical" method of formatting web pages, via "Style Sheets" which allow the precise formatting web designers wish for, and in a way that separates format from content, making it easy to update an entire web site. However, it will take some time before this functionality is common and there are still bothersome differences between different web browser software (some "standards", yes?) These "standards" turn out to be recommendations as no one has the authority to enforce them! (Note, as of 2006, web standards have made much more progress, see the Web Standards Project for more information). What does this mean? For accessibility on the widest range of possible web browsers and versions out there, stick with the most basic set of HTML code. Of course, this may limit what you'd like to put in a web page! If you include HTML that may look snazzy only in Netscape but not Internet Explorer, you may turn people away from your site. Not only that, viewers of your web pages may not only be using different browsers, but their monitor size and fonts may not be the same as on the system you designed the pages. After all, you are probably not going to spend all of this time designing web pages that are for your viewing only! The idea is to make something that the world can view. So the first section of lessons will take you through the most widely accepted features of HTML. From there, you can make the decision to use more of the "deluxe" features. 1. Creating Your First HTML Document After this lesson you will be able to: Identify the meaning and purpose of HTML tags. Open up a workspace for creating new HTML documents. Use a text editor to create the basic HTML structure for any web page. Insert non-displayed comments into your HTML files. Open your document within your web browser to see how it is displayed.

Now that you know what HTML is, let's start using it.

17

What are HTML tags? When a web browser displays a page such as the one you are reading now, it reads from a plain text file, and looks for special codes or "tags" that are marked by the < and > signs. The general format for a HTML tag is: <tag_name>string of text</tag_name> As an example, the title for this section uses a header tag: <h3>What are HTML tags?</h3> This tag tells a web browser to display the text What are HTML tags? in the style of header level 3 (We'll learn more about these tags later). HTML tags may tell a web browser to bold the text, italicize it, make it into a header, or make it be a hypertext link to another web page. It is important to note that the ending tag, </tag_name> contains the "/" slash character. This "/" slash tells a web browser to stop tagging the text. Many HTML tags are paired this way. If you forget the slash, a web browser will continue the tag for the rest of the text in your document, producing undesirable results (as an experiment you may want to try this later). NOTE: A web browser does not care if you use upper or lower case. For example, <h3>...</h3> is no different from <H3>...</H3> Unlike computer programming, if you make a typographical error in HTML you will not get a "bomb" or "crash" the system; your web page will simply look, well... wrong. It is quick and easy to go inside the HTML and make the changes. Your browser has a small but open vocabulary! An interesting aspect of HTML is that if the browser does not know what to do with a given tag, it will ignore it! For example, in this document you are viewing, the header tag for this section really looks like this:

18

<Dodo> <h3>What are HTML tags?</h3> </Dodo> but since your browser probably does not support a <Dodo> tag (I made it up, perhaps in the future it could cause the text to wave across the screen?), it proceeds with what it knows how to do. If I were programming a new web browser, I might decide to add the functionality for the <Dodo> tag into my software. Opening Up Your Workspace To complete the lessons in this tutorial, you should create a second web window (this allows you to keep this window with the lesson instructions and one window as your "workspace"), plus open your text editor application in a third window. NOTE: This is a good place to remind you that we will provide directions that are somewhat general as the menu names and file names can differ depending on which web browser you are using. If our instructions say, "Select Open Location... from the File Menu" and your web browser does not have that exact choice, try to find the closest equivalent option in your own web browser. In some web browsers (notable Internet Explorer), a new browser window opens with either a copy of the page you are viewing or your home page. Just ignore that for now, we will load new content in it below. So you will want to be pretty comfortable jumping between different applications and windows on your computer. Another option is to print out the lesson instructions (but we really do not want to promote that kind of excessive tree carnage). Here are the steps for setting up your "workspace": 1. From the File menu of your web browser, select New Window or New Web Browser (The exact name of the menu command can be different depending on what browser you are using). A second web window should appear. Think of the first window as your "textbook" and the second clone window as your "workspace" for completing the HTML lessons.

19

NOTE: The only reason to have two windows here is so that you can read the instructions for the lessons and also view your working document. It is not mandatory to have two windows open; it just makes your work easier. You could also bookmark this web page or jump back here via your Go or History menu. 2. Next, you need to jump out of the web browser, go to your desktop and open your text editor program. NOTE: You will need to move back and forth between the different windows to complete these lessons. This can be a challenge depending on the size of your monitor. You may choose to resize the three windows so that they all fit on your screen or layer your windows so you can click on any of them to bring it to the front. If you are using a word processor program to create your HTML, be sure to save in plain text (or ASCII) format. If you are just starting out, we most STRONGLY recommend that you use the simplest text editor available -- TextEdit for the Mac OSX (but you need to know how to save files as Plain Text-- as an alternative, Mac users can download the free and wonderfully simple Plain Old HTML Editor) or the Windows NotePad. Why not use those nifty HTML editors? It is sound instructional design that you first learn the concepts and THEN look for shortcuts or helpers that make the work less tedious. When you have got a few lessons under your belt, then check out some of our recommended free HTML Editors. Also, it will help you if you first create a new directory/folder on your computer that will be your work area. You can call it workarea or myspace or whatever you like; just make sure that you keep all of the files you create in this one area. It will make your life simpler... well, at least while working on this tutorial! Creating Your HTML Document An HTML document contains two distinct parts, the head and the body. The head contains information about the document that is not displayed on the screen. The body then contains everything else that is displayed as part of the web page.

20

The basic structure then of any HTML page is:

<html> <head> <!-- header info used to contain extra information about this document, not displayed on the page --> </head>

<body>

<!-- all the HTML for display --> : : : </body> </html> : : :

Enclose all HTML content within <html>...</html> tags. Inside is first your <head>...</head> and then the <body>...</body> sections. Also note the comment tags enclosed by <!hi hi hi -->. The text between the tags is NOT displayed in the web page but is for information that might be of use to you or anyone else who might look at the HTML code behind the web page. When your web pages get complicated (like you will see when we get into tables, frames, and other fun stuff about 20 lessons from now!), the comments will be very helpful when you need to update a page you may have created long ago.

21

Here are the steps for creating your first HTML file. Are you ready? 1. If it is not open already, launch your text editor program. 2. Go to the text editor window. 3. Enter the following text (you do not have to press RETURN at the end of each line; the web browser will word wrap all text):

4. 5. 6. 7.

<html> <head> <title>Volcano Web</title> </head> 8. <!Edited and updated by for the Writing HTML Tutorial by Dr. Sayed Saber --> 9. <body> 10. In this lesson you will use the Internet to research 11. information on volcanoes and then write a report on 12. your results. 13. </body> 14. </html>

NOTE: Look where the <title>...</title> tag is located. It is in the <head>...</head> portion and thus will not be visible on the screen. What does it do? The <title> tag is used to uniquely identify each document and is also displayed in the title bar of the browser window. In the following, you will learn how to add a string of text for a title that will appear directly on your web page. Also note that we have inserted a comment tag that lists the name of the author and the date the document was created. You could write anything in between the comment tags but it is only visible when you look at the source HTML for a web page. Save the document as a file called "volc.html" and keep it in the "work area" folder/directory you set up for this tutorial. Also, if you are using a word processor program to create your HTML, be sure to save in plain text (or ASCII) format.
15.

Save all of your HTML files with names that end in .HTM, or .HTML so in this case your file should be VOLC.HTM or Volc.HTML. By using this file name extension, a web browser will know to read these text files as HTML and properly display the web page.
22

Displaying Your Document in a Web Browser Return to the web browser window you are using for your "work space". (If you do not have a second browser window open yet, select New Window or New Browser from the File window.). 2. Select Open File... from the File menu. (Note: For users of Internet Explorer, click the Browse button to select your file) 3. Use the dialog box to find and open the file you created, "volc.html" 4. You should now see in the title bar of the workspace window the text "Volcano Web" and in the web page below, the one sentence of <body> text you wrote, "In this lesson..."
1.

A common mistake we hear is, "I cannot see the title!" You shouldn't! The text within the <title>...</title> tag is NOT displayed on the web page; you should see it in the title bar of the web browser window. The most common mistake that beginners make here is that they try using a word processing program to type HTML and then are unable to open it in their browser, or if it does, the page is full of odd garbage characters. When you are starting out, we urge you to use the most basic text editor. Look for shortcuts later! 2. Modifying an HTML Document Now that you have created your first HTML document, you will learn how to swiftly make changes in your document and view the updates within your web browser. After this lesson, you will be able to:

Re-open the workspace for your web page. Make changes in your HTML document using the text editor. Reload the document in your web browser to see your changes.

Re-opening Your Workspace

23

To complete this lesson, you will need to create a second web browser window and re-open the text editor window you used in the first lesson. Here are the steps for re-opening your workspace (remember that the exact name of the menu commands may be different depending which web browser you are using): If not open, create a new web browser window by selecting New Window from the File menu. 2. Use the Open File... command from the File menu to find and open the HTML file you created in the previous lesson. 3. Re-open your text editor program. 4. In the text editor, open the file ("volc.html") you created in the previous lesson.
1.

Making Changes in Your HTML Document 1. Go to the text editor window. 2. Below the text you typed from the previous lesson, press RETURN a few times and type the following text:
A volcano is a location where magma, or hot melted rock from within a planet, reaches the surface. It may happen violently, in a massive supersonic explosion, or more quietly, as a sticky, slow lava flow.

3. 4. 5. 6. 7. 8.

Note that this text should be above the </body> and </html> tags at the bottom of your HTML file. Select Save from the File menu to update the changes in your HTML file.
9.

Reloading the Document in your Web Browser Return to the web browser workspace where the previous version of your file was displayed. Note that the new text you entered in the previous steps may not yet be visible. To see the changes, use the Reload button or menu item in your web browser. This instructs your web browser to read in the same HTML file and display it with whatever changes have been made. You should now see the new text that you entered.

24

Note that the web browser ignores all blank lines and extra spaces (carriage returns) that you enter in the HTML file. It will also ignore any extra space characters (beyond the one between words). However, when you are writing HTML, it will help you greatly to separate major sections by some blank lines... when you need to go back and edit content, it makes it easier to locate the correct location to make the changes. Of course, there will be times that you want your web pages to have blank space between sections (e.g. between paragraphs). You just passed a location in this very page! In Lesson 4 we will learn how to do this. Drag and Drop Bonus There may be an easier way for you to load and view your HTML pages. You will have to arrange your computer desktop so that you can see the icon for your HTML files adjacent to your web browser window. Simply click and drag the icon for your "vol.html" or "vol.htm" file right into your web browser window. Voil! your page will display if your computer supports drag and drop operations (It works for operating for Macintosh OS 7.5 and Windows 95 or newer). Headings: Six Levels Deep As you see in this web page, the section headings ("Headings -- Six Levels Deep", "Objectives", "Lesson", "HTML Headings" ...) appear as different sizes and, perhaps, different colors and fonts. HTML provides tags for designating headings in six levels of significance. Your browser determines the exact font and size for display. After this lesson, you will be able to: Identify the different levels of headings in HTML and the tags associated with them. Place different level headings within your HTML document and view the changes within your web browser.

HTML Headings

You created headings in HTML by "tagging" certain chunks of text with heading tags. The format for an HTML heading tag is:

25

<hN>Text to Appear in Heading</hN> where N is a number from 1 to 6 identifying the heading size. Here are some examples of different heading sizes:

Heading Level 1
Heading Level 2
Heading Level 3

Heading Level 4
Heading Level 5

Heading Level 6

Heading levels range from level 1 (Most Important) to level 6 (Least Important). Like an outline, your heading levels should have logical, consistent order and be parallel.
Placing HTML Headings in Your Document

1. 2.

5. <h1>Volcano Web</h1>

Re-open your workspace (if not already opened). Go to the text editor window. 3. Open the HTML text file you created in lesson 2, "volc.html". 4. First, we will use the tag to display the title as the biggest header, <H1>. Enter the following above the existing body text and after the </head><body> tags:
6. Below the text already entered, create other headings for future sections of your Volcano Web page. Enter the following headings inside the body of your web page (Note that some are H3 and others are H2 tags):

26

7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21.

<h2>Introduction</h2> <h2>Volcano Terminology</h2> <h2>Volcanic Places in the USA</h2> <h3>Mount St Helens</h3> <h3>Long Valley</h3> <h2>Volcanic Places on Mars</h2> <h2>Research Project</h2> <h3>References</h3>

22.
23.

Save changes in your text editor. Return to your web browser, Open and Reload the HTML file.

Note that on the computer you are using now, you can use the settings in your web browser to define the fonts and/or size of the headings. For example, on one computer you could have a browser display h1 tags as Times font and 36 point; h2 tags as Helvetica font and 24 point, etc. HTML codes designate only that the headers are of a certain type (h1 to h6); how it is displayed is controlled by the user of the web browser. As an optional exercise, take a look at what happens when you make a typographical error. Open your HTML document in the text editor and delete the slash (/) in the <h1> tag, after the header Volcano Web:
<h1>Volcano Web<h1> [missing "/" ------------^^^]

Save the changes and reload into your web browser. Without the correct ending of the h1 tag, your web browser interprets all of the succeeding text as part of that header! After trying this you should go back to your document and re-insert the slash in the correct spot.

27

Paragraphing HTML Documents


Now we will discuss the followings: Identify the paragraph break tag in HTML. Copy text from the web page and paste it in another document. Insert paragraph breaks into the text of your HTML document and view the changes within your web browser.

HTML Paragraph Breaks

We've seen earlier that a web browser will ignore all of the CARRIAGE RETURNS typed into your text editor. But, wherever a browser sees the paragraph tag, it inserts a blank line and starts a new paragraph. The HTML code for forcing a paragraph break is: <p> Note that this tag is special in that it does not require an ending tag; for now you do not need to use: </p> In a later lesson we will see why we want to use <p> a closing </p> for the more current HTML coding standards. For basic HTML coding, let's keep it simple for now. Also, the <h> tags have a built in break so it is unnecessary to put <p> tag before a header tag: <p> <h2>Hi Hi Hi Hi Hi </h2>
Inserting Paragraph Breaks

28

Follow the directions below to insert and view a paragraph break in your HTML document. 1. 2. Re-open your workspace (if not already opened). Go to the text editor window. 3. Open your working document, volc.html, in the text editor (if not already opened). 4. First we want to move the sentences ("A volcano is .....") so that they are under the Introduction heading. Use the mouse to cut and paste this text in the proper location. 5. After these sentences, we want to add some more text. But rather than re-typing this in, from this web page use your mouse to select and copy the sentences:
6. 7. 8. 9. Volcanoes have been a part of earth's history long before humans. Compare the history of human beings, a few million years in the making, to that of the Earth, over four billion years in the making.

Now, return to your HTML document in the text editor, and paste this text after the existing sentences under the <h2>Introduction</h2> heading. 11. Save the changes in the text editor. 12. Return to your web browser. 13. If your working document is not visible, Use the Open Local... command from the File menu to open the document. 14. Select Reload from the File menu. You should now see the two sentences of the Introduction. We now want to put a paragraph break between these sentences. 15. Again, return to your HTML document in the text editor. 16. After the second sentence under <h2>Introduction</h2> (the one that ends " as a sticky, slow lava flow."), press RETURN (it is not necessary but it makes the HTML more readable as you work on it), and then enter the paragraph tag: 17. <p>
10. This section should now look like:
<h2>Introduction</h2> A volcano is a location where magma, or hot melted rock from within a planet, reaches the surface. It may happen violently, in a massive supersonic explosion, or more quietly, as a sticky, slow lava flow. <p>

29

Volcanoes have been a part of earth's history long before humans. Compare the history of human beings, a few million years in the making, to that of the Earth, over four billion years in the making.

18.

Save the changes in the text editor. 19. Return to your web browser and Reload the document. The two sentences of the introduction should now be separate paragraphs.

Other types of breaks


To separate major sections of a web page, use the horizontal rule or hr tag. This inserts a straight line like you see right above the heading for this section. The HTML format for a horizontal rule tag is: <hr>

Let's try it now! Put an hr tag above the Introduction heading. This will help to separate the opening sentence of the lesson from the other portions that will follow. And finally, there is the <br> tag which forces text to a new line like the <p> tag, but without inserting a blank line. You might use this tag when making a list of items, when writing the lines of a poem, etc. Compare the differences between using the <br> and <p> in these two examples:

Paragraph <p> tags Only


HTML
And then, we could all see at once the brilliant purpose of the paragraph tag. <p> Moving on... <p> the more tags you write, the better you will feel?

Result And then, we could all see at once the brilliant purpose of the paragraph tag. Moving on... the more tags you write, the better you will feel?

Paragraph <p> and Line Break <br> tags


HTML
And then, we could all see<br> at once the brilliant purpose<br> of the paragraph tag. <p> Moving on... <br> the more tags you write,<br>

Result And then, we could all see at once the brilliant purpose of the paragraph tag.

30

the better you

will feel?

Moving on... the more tags you write, the better you will feel? The <br> tag can be used for a different layout style for your section headings. If you notice, the header tags <h1>, <h2>, ... automatically insert white space above and below the text of the header tag. Some web page authors prefer a style that controls this white space.

Section titles with Header Tags


HTML
and in the end it was all for naught. <h4>The New Cheese Edict</h4> Later, sir Longhorn declared that all makers of cheese would have to be certified before commencing production.

Result and in the end it was all for naught.

The New Cheese Edict


Later, sir Longhorn declared that all makers of cheese would have to be certified before commencing production.

<b> <br> tags NOTE! The <b> tag is covered in the next lesson but all it does is make the text bold.

Section titles with


HTML

and

Result and in the end it was all for naught. The New Cheese Edict Later, sir Longhorn declared that all makers of cheese would have to be certified before commencing production.

and in the end it was all for naught. <p> <b>The New Cheese Edict</b><br> Later, sir Longhorn declared that all makers of cheese would have to be certified before commencing production.

31

Style
Just like a word processor, HTML can tell a web browser to display certain portions of text in Italic or Bold Style or even a combination. This section of HTML discuss the following: Identify the HTML tags for the text styles: bold, italic, and typewriter (mono-spaced). Enter text in your HTML document in these different text styles and view the changes within your web browser.

HTML Style Tags HTML offers several tags for adding style to your text. Just remember to be judicious and consistent in the use of styles; too much can make the text uncomfortable to read...

Style tags
HTML
<b>This is Bold...</b> <i>This is Italic...</i> <tt>This is Typewriter...</tt>

Result This is Bold This is Italic


This is Typewriter

Note how you can combine the style tags as long as they are correctly nested, the italic tags are both within the bold tags. Note also, that the order does not matter. HTML Result
<i><b>This is Bold AND Italic</b></i> <b><i>And So is This</i></b>

This is Bold AND Italic And So is This

Furthermore, you can also add style to the text that appears in heading tags. Note how the different style tags are opened and closed around the words they style and how the heading tags surround the whole text for the heading.

32

HTML
Hi Hi Hi Hi <h2><i>New</i> and <tt>Improved!</tt></h2> Hi Hi Hi Hi

Result
Hi Hi Hi Hi

New and Improved!


Hi Hi Hi Hi

Entering Styled Text in HTML Document


Follow these steps to apply style tags to your HTML document. Re-open your workspace (if not already opened). 2. Return to your HTML document, volc.html, in the text editor. 3. Find the word "volcano" in the first sentence of the Introduction. We are going to make this bold to highlight an important word. 4. Insert the tags to make this word appear as bold text: 5. <b>volcano</b> 6. Now we will modify the second paragraph with the bold and italic tags to emphasize a word. Enter <b>...</b> and <i>...</i> tags around the word billion so this section looks like:
7. 8. 9. 10. 11. <p> Volcanoes have been a part of earth's history long before humans. Compare the history of human beings, a few million years in the making, to that of the Earth, over four <b><i>billion</i></b> years in the making. Finally, we will use the typewriter, tag to indicate a special word. Under The study of volcanoes, or <tt>Volcanology</tt>, includes many odd terms.

1.

13. 14.

12. the Volcano Terminology heading, enter the following: 15.

Save in the text editor and Reload in your web browser.

33

Lists
Lists can present items of information in an easy-to-read format. In fact, there is a list right here, lurking under the next heading! After this lesson, you will be able to: Identify HTML codes for creating unordered, ordered, and nested lists for a web page. Place different list types within your HTML document and view the changes within your web page.

Many web pages display lists of items -- these may be items preceded with a "bullet" (Unordered) or a sequentially numbered list (Ordered). These lists are easy to format in HTML, and they may even be nested (lists of lists) to produce an outline format. Lists are also handy for creating an index or table of contents to a series of documents or chapters.

Unordered Lists
Unordered Lists, or <ul> .. </ul> tags, are ones that appear as a list of items with "bullets" or markers in the front. The bullet marks will depend on the particular version of your web browser and the font specified for displaying normal WWW text (e.g. for Macintosh, the bullets are the option-8 character -- in Times font this is a small square, in Geneva it is a large round dot). Here is an example of an unordered list:

My Unordered List:

Item 1 Item 2 Item 3

And this is the HTML format for producing this format:


<b>My Unordered List:</b> <ul> <li> Item 1 <li> Item 2

34

<li> Item 3 </ul>

The <ul> tag marks the beginning and end of the list, and the <li> indicates each list item.

Ordered Lists
Ordered lists are ones where the browser numbers each successive list item starting with "1." Note that the only difference is changing the ul tag to ol tag. Using the example from above:

My Ordered List: 1. 2. 3. Item 1 Item 2 Item 3

And this is the HTML format for producing this format:


<b>My Ordered List:</b> <ol> <li> Item 1 <li> Item 2 <li> Item 3 </ol>

Nested Lists
Ordered Lists and Unordered lists can have different levels; each will be indented appropriately by your web browser. Your major concern will be to verify that each list is properly terminated and the nesting order is correct. It can start to look complicated with all of those <ol> <li> </ul> <li> tags floating around, but just try to remember the basic structure:
<ul> <ol> <li> <li> </ol>

<li> <li> </ul>

Here is an example of an unordered list with sublevels of other lists:

35

Nested Unordered List


This is the first item This is the second item o This is the first subitem of the second item And this is a subitem of a subitem Getting lost yet? o This is the second subitem of the second item o This is the third subitem of the second item This is the third item

Note how the bullet marks change for different levels of the list. And this is the HTML format for producing this format:

<b>Nested Unordered List</b> <ul> <li>This is the first item <li>This is the second item <ul> <li> This is the first subitem of the second item <ul> <li> And this is a subitem of a subitem <li> Getting lost yet? </ul> <li> This is the second subitem of the second item <li> This is the third subitem of the second item </ul> <li>This is the third item </ul>

Nested Lists -- Mixing them together


Not only can you include ordered lists within ordered lists, but you can also mix and match list types. Hold onto your hats! The HTML starts to look pretty ugly, but watch how lists completely contain other lists. For example, this ordered list includes a nested unordered list:

36

Nested Unordered List Nested Unordered List 1. 2. This is the first item This is the second item o This is the first subitem of the second item 1. An this is a numbered subitem of a subitem 2. An this is another numbered subitem of a subitem 3. Getting lost yet? o This is the second subitem of the second item o This is the third subitem of the second item This is the third item

3.

And this is the HTML format for producing this format. Note how the HTML has been indented to make it easier to read:

<b>Nested Unordered List</b> <ol> <li>This is the first item <li>This is the second item <ul> <li> This is the first subitem of the second item <ol> <li> And this is a numbered subitem of a subitem <li> And this is another numbered subitem of a subitem <li> Getting lost yet? </ol> <li> This is the second subitem of the second item <li> This is the third subitem of the second item </ul> <li>This is the third item </ol>

Placing Lists in Your HTML Document


Using the list tags, you will now add an ordered and an unordered list to your Volcano Web page. 1. Re-open your workspace (if not already opened).

37

2. Open your HTML document in the text editor. 3. Under the Volcano Terminology header we will use an unordered list to display examples of technical words used in the study of volcanoes. Go to this section in your HTML document. 4. First add the following sentence.
How many of these do you know?

6. 7. 8. 9. 10. 11. 12.

5.

Now enter the HTML format to create the list of terms:


<ul> <li>caldera <li>vesicularity <li>pahoehoe <li>rheology <li>lahar </ul>

13. Now we will use an ordered list to define the required parts of the assignment in this lesson. Under the Research Project heading, enter the following: (HINT -- this might be a good time to copy and paste from the web page, unless you enjoy typing in text!)

38

14. Your mission is to find information and report on a volcano, 15. other than the ones listed above, that has erupted in the last 16. 100 years. Your reports must include: 17. <ol> 18. <li>Type of volcano 19. <li>Geographic location 20. <li>Name, distance, and population of nearest major city 21. <li>Dates of most recent and most destructive eruptions. 22. <li>Other events associated with the recent eruptions 23. (earthquakes, floods, mudslides, etc) 24. </ol> 25. <p> 26. Then, write a one page description on the major hazards to humans in the vicinity of this volcano. Speculate on what you would do if you were in charge of minimizing the risk to the population.

27.

Save your HTML file and Reload in your web browser.

Graphics
Sending text over the Internet is just old fashioned e-mail. People have been doing it for decades! When you can include Pictures, your message can be much more informative! After this lesson, you will be able to: Identify the graphic formats for the World Wide Web. Discuss key points to consider when including graphics in WWW documents. Download a graphic file to your computer. Use the correct HTML format for including pictures in your web page.

Lean back and relax! This lesson is mostly an introduction to graphics for the Web. But we'll have you do a little activity below.

The Web's Graphic Format


There are numerous file formats for computer graphics... PICT, GIF, TIFF, PNG, not to mention EPS, BMP, PCX, JPEG... It sounds like cryptic poetry. Bad poetry. Geek poetry! The way a web browser displays graphics in HTML format indicates the location of a graphic file in a single format that can be interpreted by different types of computers. For example, when the information in that format is received by your Macintosh

39

computer, the web browser knows to display it as a picture format for Macintosh. However, when that same information is received by your Windows browser, it is displayed as a Windows graphic. In technical jargon, we would say that this picture format is platform independent. HTML itself is platform independent, since plain text characters can be understood by any computer. The standard format that can display within a web page is GIF or Graphics Interchange Format. The GIF compresses the picture information (reduces the file size) and translates it to binary code that can be sent over the Internet. GIF compression is most effective on graphics that have contiguous areas of solid color, and compression is even greater when the color is continuous in the horizontal direction. GIF images have the feature of defining a color to be "transparent" so images can appear to have nonrectangular boundaries. They can also be saved in the "interlaced" format so that when you see a web page, the images start to appear soon and "dissolve" to the final image. The other file format used on the web is JPEG (named after the Joint Photographic Expert Group that designed this format). In the early web years, JPEG images were not displayed in the page but were displayed in a separate window, using an external "helper" application. But most web browsers these days support JPEG images to be displayed right in the web page too. JPEG compression is very effective for photographic images where the colors can vary spatially over short distances ("grainy" images). JPEG offers some dramatic compression in filesize, sometimes by a factor of 10 (e.g. a 1500 kb file reduced to 150 kb), which may be at a trade-off for some image quality. JPEG images do not have the ability to have transparency. For more information about these file formats, see the SITO page on Graphics File Compression. If you are in the mood for a great book, try Lynda Weinman's Designing Web Graphics. More and more graphics programs have built-in features to save files as GIF format. Newer ones such as ImageReady from Adobe and Fireworks from Macromedia have been specifically designed for creating web graphics. You can find other shareware programs/utilities for converting graphics to web format from download.com.

Some Points to Consider When Using Graphics


For this tutorial, you do not have to use one of these graphics programs. We will show you how to get a copy of the images that you will need. However, as you begin to develop your own web pages, you should become familiar with creating pictures in either GIF or JPEG format. If your web pages include graphics, consider the following:

40

Large and numerous images may look great on a high-end computer, but they will frustrate users who must wait for images to be sent over the network. As a suggestion, keep the total file size of all images on a web less than 100k (we aim for less than 50k each). Not all of us have a 21-inch computer monitor! Keep graphic images no wider than 480 pixels and no higher than 300 pixels to avoid forcing users to scroll or resize their web browser window. Color gradients may look pretty but for GIF images they do not compress as much as solid color areas and they can sometimes come out "banded". Some graphics programs offer options for "no dithering" when converting to GIF -- this can reduce the amount of "noise" in a solid background. Many dark grey tones on Macintosh computers are not discernible on Windows computers. Rather than displaying all of the images on the web page, have them linked as external images that are downloaded only when a viewer clicks on a hypertext item. If you have numerous pictures to display, try to break the web page into a series of linked pages. A single image (e.g. a small "bullet") can appear several times in a web page with little added delay each time you use that same image. Many web browsers "cache" images (storing them on your computer) meaning that using the same file in several web pages will load them from the viewer's computer rather than loading them across the Internet. Most importantly, make sure that the images are ones that add meaning to your HTML documents.

You may design a beautiful web page, loaded with large pictures, that may load nicely from your computer, but may be excruciatingly slow by a viewer using a slow modem over a busy network. The 'net is a busy place and getting busier every second.

Saving and Including Pictures in Your Web Page


For the next lesson you will first need to download a copy of a GIF image of a volcano (watch out for that hot lava!). Just follow the instructions on the Lesson 7 Image Studio and then return here to complete this lesson.

Independent Practice
Surf the web and browse for pictures. Try to download at least one image that might be useful for your page. Just a few places you might try:

ClipArt Connection CoolText Online Graphics Generator Ditto.com Yahoo's Clip Art 41

Lycos' Picture Search Yahoo's ImageSurf The Free Site Free Graphics Store Barry's Clip Art Server

Coming Next....
You have the image... Now, how in the H T M L do you display it in your document

42

Hyperlinks in various technologies Hyperlinks in HTML Tim Berners-Lee saw the possibility of using hyperlinks to link any unit of information to any other unit of information over the Internet. Hyperlinks were therefore integral to the creation of the World Wide Web. Links are specified in HTML using the <a> (anchor) elements.
XLink: Hyperlinks in XML

The W3C Recommendation called XLink describes hyperlinks which offer a far greater degree of functionality than those offered in HTML. These extended links can be multidirectional, linking from, within, and between XML documents. It also describes simple links which are unidirectional and therefore offer no more functionality than hyperlinks in HTML. Hyperlinks in other technologies Hyperlinks are used in e-mails, Text editors, PDF documents, word processing documents, spreadsheets, Apple's HyperCard and many other places. How hyperlinks work in HTML A link has two ends, called anchors, and a direction. The link starts at the source anchor and points to the destination anchor. However, the term link is often used for the source anchor, while the destination anchor is called the link target. The most common link target is a URL used in the World Wide Web. This can refer to a document, e.g. a webpage, or other resource, or to a position in a webpage. The latter is achieved by means of a HTML element with a "name" or "id" attribute at that position of the HTML document. The URL of the position is the URL of the webpage with "#attribute name" appended.

43

When linking to PDF documents from a HTML page the "attribute name" can be replaced with syntax that references a page number or another element of the PDF, for example page=[pageNo] - "#page=386". Link behavior in web browsers A web browser usually displays a hyperlink in some distinguishing way, e.g. in a different colour, font or style. The behaviour and style of links can be specified using the Cascading Style Sheets (CSS) language. In a graphical user interface, the usage of a mouse cursor may also change into a hand motif to indicate a link. In most graphical web browsers, links are displayed in underlined blue text when not cached, but underlined purple text when cached. When the user activates the link (e.g. by clicking on it with the mouse) the browser will display the target of the link. If the target is not a HTML file, depending on the file type and on the browser and its plugins, another program may be activated to open the file. The HTML code contains some or all of the five main characteristics of a link:

link destination ("href" pointing to a URL) link label link title link target link class or link id

It uses the HTML element "a" with the attribute "href" and optionally also the attributes "title", "target", and "class" or "id": <a href="URL" title="link title" target="link target" class="link class">link label</a> Example: To embed a link into a Page, blogpost, or comment, it may take this form: <a href="http://www.wikipedia.org">Wikipedia</a> Thus, the complex link string is reduced to, [Wikipedia]. This contributes to a clean, easy to read text or document.
44

When the cursor hovers over a link, depending on the browser and/or graphical user interface, some informative text about the link can be shown: It pops up, not in a regular window, but in a special hover box, which disappears when the cursor is moved away (sometimes it disappears anyway after a few seconds, and reappears when the cursor is moved away and back). IE and Mozilla Firefox show the title, Opera also shows the URL. In addition, the URL may be shown in the status bar.

Normally, a link will open in the current frame or window, but sites that use frames and multiple windows for navigation can add a special "target" attribute to specify where the link will be loaded. Windows can be named upon creation, and that identifier can be used to refer to it later in the browsing session. If no current window exists with that name, a new window will be created using the ID. Creation of new windows is probably the most common use of the "target" attribute. In order to prevent accidental reuse of a window, the special window names "_blank" and "_new" are usually available, and will always cause a new window to be created. It is especially common to see this type of link when one large website links to an external page. The intention in that case is to ensure that the person browsing is aware that there is no endorsement of the site being linked to by the site that was linked from. However, the attribute is sometimes overused and can sometimes cause many windows to be created even while browsing a single site. Another special page name is "_top", which causes any frames in the current window to be cleared away so that browsing can continue in the full window. History of the hyperlink The term "hyperlink" was coined in 1965 (or possibly 1964) by Ted Nelson at the start of Project Xanadu. Nelson had been inspired by "As We May Think," a popular essay by Vannevar Bush. In the essay, Bush described a microfilm-based machine in which one could link any two pages of information into a "trail" of related information, and then scroll back and forth among pages in a trail as if they were on a single microfilm reel. The closest contemporary analogy would be to build a list of bookmarks to

45

topically related Web pages and then allow the user to scroll forward and backward through the list. In a series of books and articles published from 1964 through 1980, Nelson transposed Bush's concept of automated cross-referencing into the computer context, made it applicable to specific text strings rather than whole pages, generalized it from a local desk-sized machine to a theoretical worldwide computer network, and advocated the creation of such a network. Meanwhile, working independently, a team led by Douglas Engelbart (with Jeff Rulifson as chief programmer) was the first to implement the hyperlink concept for scrolling within a single document (1966), and soon after for connecting between paragraphs within separate documents (1968). See NLS. Legal and moral issues concerning hyperlinks While hyperlinking among pages of Internet content has long been considered an intrinsic feature of the Internet, some websites have claimed that linking to them is not allowed without permission. In some jurisdictions it is or has been held that hyperlinks are not merely references or citations, but are devices for copying web pages. In the Netherlands, for example, Karin Spaink was initially convicted of copyright infringement for linking, although this ruling was overturned in 2003. Although this principle is generally rejected by digerati, the courts that adhere to it see the mere publication of a hyperlink that connects to illegal material to be an illegal act in itself, regardless of whether referencing illegal material is illegal. In Japan, it is considered rude to link to a personal website-especially that of an artist-- without getting permission beforehand. Some sites use the phrase "Link Free" on their websites to indicate that they will not be upset by unauthorized linking. In 2000, British Telecom sued Prodigy claiming that Prodigy infringed its patent (U.S. Patent 4,873,662 ) on web hyperlinks. However, after costly litigation, a court found for Prodigy, ruling that British Telecom's patent did not actually cover web hyperlinks. [1] Moreover, although there is not much case law to support it, some have argued that hyperlinks could infringe the "making available right" provided in the WIPO Internet treatises.
46

When linking to illegal or infringing copyrighted content the law of linking liability is currently considered a grey area. There are examples where sites have been proven liable such as Plaintiff Intellectual Reserve vs Utah Lighthouse Ministry, Universal City Studios, Inc. v. Reimerdes, and Comcast vs. Hightech Electronics Inc [2] and there are examples where sites have not been proven liable for linking, for example Perfect 10 v. Google Inc. The cases of websites are proved liable outweigh those where websites were not liable. World Wide Web Consortium The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web (W3). It is arranged as a consortium where member organizations maintain full-time staff for the purpose of working together in the development of standards for the W3. W3C also engages in education and outreach, develops software and serves as an open forum for discussion about the Web. The Consortium is headed by Tim Berners-Lee, the primary author of the original URL (Uniform Resource Locator), HTTP (HyperText Transfer Protocol) and HTML (HyperText Markup Language) specifications, the principal technologies that form the basis of the World Wide Web. History The consortium was created to ensure compatibility and agreement among industry members in the adoption of new standards. Prior to its creation, incompatible versions of HTML were offered by different vendors, increasing the potential for inconsistency between web pages. The consortium was created to get all those vendors to agree on a set of core principles and components which would be supported by everyone.

Uniform Resource Identifier


A Uniform Resource Identifier (URI), is a compact string of characters used to identify or name a resource. The main purpose of this identification is to enable interaction with representations of the resource over a network, typically the World Wide Web, using specific protocols. URIs are defined in schemes defining a specific syntax and associated protocols.

47

The global structure of an HTML document Introduction to the structure of an HTML document
An HTML document is composed of three parts: 1. a line containing HTML version information, 2. a declarative header section (delimited by the HEAD element), 3. a body, which contains the document's actual content. The body may be implemented by the BODY element or the FRAMESET element. White space (spaces, newlines, tabs, and comments) may appear before or after each section. Sections 2 and 3 should be delimited by the HTML element. Here's an example of a simple HTML document: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>My first HTML document</TITLE> </HEAD> <BODY> <P>Hello world! </BODY> </HTML>

HTML version information


A valid HTML document declares what version of HTML is used in the document. The document type declaration names the document type definition (DTD) in use for the document. HTML 4.01 specifies three DTDs, so authors must include one of the following document type declarations in their documents. The DTDs vary in the elements they support. The HTML 4.01 Strict DTD includes all elements and attributes that have not been deprecated or do not appear in frameset documents. For documents that use this DTD, use this document type declaration:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

48

The HTML 4.01 Transitional DTD includes everything in the strict DTD plus deprecated elements and attributes (most of which concern visual presentation). For documents that use this DTD, use this document type declaration:

"http://www.w3.org/TR/html4/strict.dtd">

The HTML 4.01 Frameset DTD includes everything in the transitional DTD plus frames as well. For documents that use this DTD, use this document type declaration: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

The URI in each document type declaration allows user agents to download the DTD and any entity sets that are needed. The following (relative) URIs refer to DTDs and entity sets for HTML 4:

"strict.dtd" -- default strict DTD "loose.dtd" -- loose DTD "frameset.dtd" -- DTD for frameset documents "HTMLlat1.ent" -- Latin-1 entities "HTMLsymbol.ent" -- Symbol entities "HTMLspecial.ent" -- Special entities

The binding between public identifiers and files can be specified using a catalog file following the format recommended by the Oasis Open Consortium (see [OASISOPEN]). A sample catalog file for HTML 4.01 is included at the beginning of the section on SGML reference information for HTML. The last two letters of the declaration indicate the language of the DTD. For HTML, this is always English ("EN"). Note. As of the 24 December version of HTML 4.01, the HTML Working Group commits to the following policy: Any changes to future HTML 4 DTDs will not invalidate documents that conform to the DTDs of the present specification. The HTML Working Group reserves the right to correct known bugs. Software conforming to the DTDs of the present specification may ignore features of future HTML 4 DTDs that it does not recognize.

This means that in a document type declaration, authors may safely use a system identifier that refers to the latest version of an HTML 4 DTD. Authors may also choose to use a system identifier that refers to a specific (dated) version of an HTML 4 DTD when validation to that particular DTD is required. W3C will make every effort to make archival documents indefinitely available at their original address in their original form.

49

The HTML element


<!ENTITY % html.content "HEAD, BODY"> <!ELEMENT HTML O O (%html.content;) -- document root element --> <!ATTLIST HTML %i18n; -- lang, dir ->

Start tag: optional, End tag: optional Attribute definitions version = cdata [CN] Deprecated. The value of this attribute specifies which HTML DTD version governs the current document. This attribute has been deprecated because it is redundant with version information provided by the document type declaration. Attributes defined elsewhere

lang (language information), dir (text direction)

After document type declaration, the remainder of an HTML document is contained by the HTML element. Thus, a typical HTML document has this structure: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> ...The head, body, etc. goes here... </HTML>

The document head


The HEAD element
<!-- %head.misc; defined earlier on as "SCRIPT|STYLE|META|LINK|OBJECT" --> <!ENTITY % head.content "TITLE & BASE?"> <!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head --> <!ATTLIST HEAD %i18n; -- lang, dir -profile %URI; #IMPLIED -- named dictionary of meta info -> Start tag: optional, End tag: optional

50

Attribute definitions profile = uri [CT] This attribute specifies the location of one or more meta data profiles, separated by white space. For future extensions, user agents should consider the value to be a list even though this specification only considers the first URI to be significant. Profiles are discussed below in the section on meta data.

Attributes defined elsewhere

lang (language information), dir (text direction)

The HEAD element contains information about the current document, such as its title, keywords that may be useful to search engines, and other data that is not considered document content. User agents do not generally render elements that appear in the HEAD as content. They may, however, make information in the HEAD available to users through other mechanisms.

The TITLE element


<!-- The TITLE element is not considered part of the flow of text. It should be displayed, for example as the page header or window title. Exactly one title is required per document. --> <!ELEMENT TITLE - - (#PCDATA) -(%head.misc;) -- document title --> <!ATTLIST TITLE %i18n> Start tag: required, End tag: required Attributes defined elsewhere

lang (language information), dir (text direction)

Every HTML document must have a TITLE element in the HEAD section. Authors should use the TITLE element to identify the contents of a document. Since users often consult documents out of context, authors should provide context-rich titles. Thus, instead of a title such as "Introduction", which doesn't provide much contextual background, authors should supply a title such as "Introduction to Medieval BeeKeeping" instead. For reasons of accessibility, user agents must always make the content of the TITLE element available to users (including TITLE elements that occur in frames). The mechanism for doing so depends on the user agent (e.g., as a caption, spoken).

51

Titles may contain character entities (for accented characters, special characters, etc.), but may not contain other markup (including comments). Here is a sample document title: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>A study of population dynamics</TITLE> ... other head elements... </HEAD> <BODY> ... document body... </BODY> </HTML>

The title attribute


Attribute definitions title = text [CS] This attribute offers advisory information about the element for which it is set. Unlike the TITLE element, which provides information about an entire document and may only appear once, the title attribute may annotate any number of elements. Please consult an element's definition to verify that it supports this attribute. Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object). Audio user agents may speak the title information in a similar context. For example, setting the attribute on a link allows user agents (visual and non-visual) to tell users about the nature of the linked resource: ...some text... Here's a photo of <A href="http://someplace.com/neatstuff.gif" title="Me scuba diving"> me scuba diving last summer </A> ...some more text... The title attribute has an additional role when used with the LINK element to designate an external style sheet. Please consult the section on links and style sheets for details.

52

Note. To improve the quality of speech synthesis for cases handled poorly by standard techniques, future versions of HTML may include an attribute for encoding phonemic and prosodic information.

Meta data
Note. The W3C Resource Description Framework (see [RDF10]) became a W3C Recommendation in February 1999. RDF allows authors to specify machine-readable metadata about HTML documents and other network-accessible resources. HTML lets authors specify meta data -- information about a document rather than document content -- in a variety of ways. For example, to specify the author of a document, one may use the META element as follows: <META name="Author" content="Dave Raggett"> The META element specifies a property (here "Author") and assigns a value to it (here "Dave Raggett"). This specification does not define a set of legal meta data properties. The meaning of a property and the set of legal values for that property should be defined in a reference lexicon called a profile. For example, a profile designed to help search engines index documents might define properties such as "author", "copyright", "keywords", etc.

Specifying meta data


In general, specifying meta data involves two steps: 1. Declaring a property and a value for that property. This may be done in two ways: 1. From within a document, via the META element. 2. From outside a document, by linking to meta data via the LINK element (see the section on link types). 2. Referring to a profile where the property and its legal values are defined. To designate a profile, use the profile attribute of the HEAD element. Note that since a profile is defined for the HEAD element, the same profile applies to all META and LINK elements in the document head. User agents are not required to support meta data mechanisms. For those that choose to support meta data, this specification does not define how meta data should be interpreted.

The META element


<!ELEMENT META - O EMPTY -- generic metainformation --> 53

<!ATTLIST META %i18n; http-equiv NAME name NAME content CDATA scheme CDATA >

-- lang, dir, for use with content -#IMPLIED -- HTTP response header name -#IMPLIED -- metainformation name -#REQUIRED -- associated information -#IMPLIED -- select form of content --

Start tag: required, End tag: forbidden Attribute definitions For the following attributes, the permitted values and their interpretation are profile dependent: name = name [CS] This attribute identifies a property name. This specification does not list legal values for this attribute. content = cdata [CS] This attribute specifies a property's value. This specification does not list legal values for this attribute. scheme = cdata [CS] This attribute names a scheme to be used to interpret the property's value (see the section on profiles for details). http-equiv = name [CI] This attribute may be used in place of the name attribute. HTTP servers use this attribute to gather information for HTTP response message headers. Attributes defined elsewhere

lang (language information), dir (text direction)

The META element can be used to identify properties of a document (e.g., author, expiration date, a list of key words, etc.) and assign values to those properties. This specification does not define a normative set of properties. Each META element specifies a property/value pair. The name attribute identifies the property and the content attribute specifies the property's value. For example, the following declaration sets a value for the Author property: <META name="Author" content="Dave Raggett"> The lang attribute can be used with META to specify the language for the value of the content attribute. This enables speech synthesizers to apply language dependent pronunciation rules.

54

In this example, the author's name is declared to be French: <META name="Author" lang="fr" content="Arnaud Le Hors"> Note. The META element is a generic mechanism for specifying meta data. However, some HTML elements and attributes already handle certain pieces of meta data and may be used by authors instead of META to specify those pieces: the TITLE element, the ADDRESS element, the INS and DEL elements, the title attribute, and the cite attribute. Note. When a property specified by a META element takes a value that is a URI, some authors prefer to specify the meta data via the LINK element. Thus, the following meta data declaration: <META name="DC.identifier" content="http://www.ietf.org/rfc/rfc1866.txt"> might also be written: <LINK rel="DC.identifier" type="text/plain" href="http://www.ietf.org/rfc/rfc1866.txt">
META and HTTP headers

The http-equiv attribute can be used in place of the name attribute and has a special significance when documents are retrieved via the Hypertext Transfer Protocol (HTTP). HTTP servers may use the property name specified by the http-equiv attribute to create an [RFC822]-style header in the HTTP response. Please see the HTTP specification ([RFC2616]) for details on valid HTTP headers. The following sample META declaration: <META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT"> will result in the HTTP header: Expires: Tue, 20 Aug 1996 14:25:27 GMT This can be used by caches to determine when to fetch a fresh copy of the associated document. Note. Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. Authors should not use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects.

55

META and search engines

A common use for META is to specify keywords that a search engine may use to improve the quality of search results. When several META elements provide languagedependent information about a document, search engines may filter on the lang attribute to display search results using the language preferences of the user. For example, <-- For speakers of US English --> <META name="keywords" lang="en-us" content="vacation, Greece, sunshine"> <-- For speakers of British English --> <META name="keywords" lang="en" content="holiday, Greece, sunshine"> <-- For speakers of French --> <META name="keywords" lang="fr" content="vacances, Gr&egrave;ce, soleil"> The effectiveness of search engines can also be increased by using the LINK element to specify links to translations of the document in other languages, links to versions of the document in other media (e.g., PDF), and, when the document is part of a collection, links to an appropriate starting point for browsing the collection. Further help is provided in the section on helping search engines index your Web site.
META and PICS

The Platform for Internet Content Selection (PICS, specified in [PICS]) is an infrastructure for associating labels (meta data) with Internet content. Originally designed to help parents and teachers control what children can access on the Internet, it also facilitates other uses for labels, including code signing, privacy, and intellectual property rights management. This example illustrates how one can use a META declaration to include a PICS 1.1 label: <HEAD> <META http-equiv="PICS-Label" content=' (PICS-1.1 "http://www.gcf.org/v2.5" labels on "1994.11.05T08:15-0500" until "1995.12.31T23:59-0000" for "http://w3.org/PICS/Overview.html" ratings (suds 0.5 density 0 color/hue 1)) '> <TITLE>... document title ...</TITLE> </HEAD>
META and default information

56

The META element may be used to specify the default information for a document in the following instances:

The default scripting language. The default style sheet language. The document character encoding.

The following example specifies the character encoding for a document as being ISO8859-5 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">

Meta data profiles


The profile attribute of the HEAD specifies the location of a meta data profile. The value of the profile attribute is a URI. User agents may use this URI in two ways: As a globally unique name. User agents may be able to recognize the name (without actually retrieving the profile) and perform some activity based on known conventions for that profile. For instance, search engines could provide an interface for searching through catalogs of HTML documents, where these documents all use the same profile for representing catalog entries. As a link. User agents may dereference the URI and perform some activity based on the actual definitions within the profile (e.g., authorize the usage of the profile within the current HTML document). This specification does not define formats for profiles.

This example refers to a hypothetical profile that defines useful properties for document indexing. The properties defined by this profile -- including "author", "copyright", "keywords", and "date" -- have their values set by subsequent META declarations. <HEAD profile="http://www.acme.com/profiles/core"> <TITLE>How to complete Memorandum cover sheets</TITLE> <META name="author" content="John Doe"> <META name="copyright" content="&copy; 1997 Acme Corp."> <META name="keywords" content="corporate,guidelines,cataloging"> <META name="date" content="1994-11-06T08:49:37+00:00"> </HEAD> As this specification is being written, it is common practice to use the date formats described in [RFC2616], section 3.3. As these formats are relatively hard to process, we recommend that authors use the [ISO8601] date format. For more information, see the sections on the INS and DEL elements. The scheme attribute allows authors to provide user agents more context for the correct interpretation of meta data. At times, such additional information may be critical, as when meta data may be specified in different formats. For example, an author might specify a

57

date in the (ambiguous) format "10-9-97"; does this mean 9 October 1997 or 10 September 1997? The scheme attribute value "Month-Day-Year" would disambiguate this date value. At other times, the scheme attribute may provide helpful but non-critical information to user agents. For example, the following scheme declaration may help a user agent determine that the value of the "identifier" property is an ISBN code number: <META scheme="ISBN" name="identifier" content="0-8230-2355-9"> Values for the scheme attribute depend on the property name and the associated profile. Note. One sample profile is the Dublin Core (see [DCORE]). This profile defines a set of recommended properties for electronic bibliographic descriptions, and is intended to promote interoperability among disparate description models.

The document body


7.5.1 The BODY element
<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body --> <!ATTLIST BODY %attrs; -- %coreattrs, %i18n, %events -onload %Script; #IMPLIED -- the document has been loaded -onunload %Script; #IMPLIED -- the document has been removed -> Start tag: optional, End tag: optional Attribute definitions background = uri [CT] Deprecated. The value of this attribute is a URI that designates an image resource. The image generally tiles the background (for visual browsers). text = color [CI] Deprecated. This attribute sets the foreground color for text (for visual browsers). link = color [CI] Deprecated. This attribute sets the color of text marking unvisited hypertext links (for visual browsers). vlink = color [CI] Deprecated. This attribute sets the color of text marking visited hypertext links (for visual browsers). alink = color [CI]

58

Deprecated. This attribute sets the color of text marking hypertext links when selected by the user (for visual browsers). Attributes defined elsewhere id, class (document-wide identifiers) lang (language information), dir (text direction) title (element title) style (inline style information) bgcolor (background color) onload, onunload (intrinsic events) onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events)

The body of a document contains the document's content. The content may be presented by a user agent in a variety of ways. For example, for visual browsers, you can think of the body as a canvas where the content appears: text, images, colors, graphics, etc. For audio user agents, the same content may be spoken. Since style sheets are now the preferred way to specify a document's presentation, the presentational attributes of BODY have been deprecated. DEPRECATED EXAMPLE: The following HTML fragment illustrates the use of the deprecated attributes. It sets the background color of the canvas to white, the text foreground color to black, and the color of hyperlinks to red initially, fuchsia when activated, and maroon once visited. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> <TITLE>A study of population dynamics</TITLE> </HEAD> <BODY bgcolor="white" text="black" link="red" alink="fuchsia" vlink="maroon"> ... document body... </BODY> </HTML> Using style sheets, the same effect could be accomplished as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>A study of population dynamics</TITLE> <STYLE type="text/css">

59

BODY { background: white; color: black} A:link { color: red } A:visited { color: maroon } A:active { color: fuchsia } </STYLE> </HEAD> <BODY> ... document body... </BODY> </HTML> Using external (linked) style sheets gives you the flexibility to change the presentation without revising the source HTML document: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>A study of population dynamics</TITLE> <LINK rel="stylesheet" type="text/css" href="smartstyle.css"> </HEAD> <BODY> ... document body... </BODY> </HTML> Framesets and HTML bodies. Documents that contain framesets replace the BODY element by the FRAMESET element. Please consult the section on frames for more information.

Element identifiers: the id and class attributes


Attribute definitions id = name [CS] This attribute assigns a name to an element. This name must be unique in a document. class = cdata-list [CS] This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters. The id attribute assigns a unique identifier to an element (which may be verified by an SGML parser). For example, the following paragraphs are distinguished by their id values: <P id="myparagraph"> This is a uniquely named paragraph.</P> <P id="yourparagraph"> This is also a uniquely named paragraph.</P>

60

The id attribute has several roles in HTML: As a style sheet selector. As a target anchor for hypertext links. As a means to reference a particular element from a script. As the name of a declared OBJECT element. For general purpose processing by user agents (e.g. for identifying fields when extracting data from HTML pages into a database, translating HTML documents into other formats, etc.).

The class attribute, on the other hand, assigns one or more class names to an element; the element may be said to belong to these classes. A class name may be shared by several element instances. The class attribute has several roles in HTML: As a style sheet selector (when an author wishes to assign style information to a set of elements). For general purpose processing by user agents.

In the following example, the SPAN element is used in conjunction with the id and class attributes to markup document messages. Messages appear in both English and French versions. <!-- English messages --> <P><SPAN id="msg1" class="info" lang="en">Variable declared twice</SPAN> <P><SPAN id="msg2" class="warning" lang="en">Undeclared variable</SPAN> <P><SPAN id="msg3" class="error" lang="en">Bad syntax for variable name</SPAN> <!-- French messages --> <P><SPAN id="msg1" class="info" lang="fr">Variable d&eacute;clar&eacute;e deux fois</SPAN> <P><SPAN id="msg2" class="warning" lang="fr">Variable ind&eacute;finie</SPAN> <P><SPAN id="msg3" class="error" lang="fr">Erreur de syntaxe pour variable</SPAN> The following CSS style rules would tell visual user agents to display informational messages in green, warning messages in yellow, and error messages in red: SPAN.info { color: green } SPAN.warning { color: yellow } SPAN.error { color: red } Note that the French "msg1" and the English "msg1" may not appear in the same document since they share the same id value. Authors may make further use of the id attribute to refine the presentation of individual messages, make them target anchors, etc. Almost every HTML element may be assigned identifier and class information.

61

Suppose, for example, that we are writing a document about a programming language. The document is to include a number of preformatted examples. We use the PRE element to format the examples. We also assign a background color (green) to all instances of the PRE element belonging to the class "example". <HEAD> <TITLE>... document title ...</TITLE> <STYLE type="text/css"> PRE.example { background : green } </STYLE> </HEAD> <BODY> <PRE class="example" id="example-1"> ...example code here... </PRE> </BODY> By setting the id attribute for this example, we can (1) create a hyperlink to it and (2) override class style information with instance style information. Note. The id attribute shares the same name space as the name attribute when used for anchor names. Please consult the section on anchors with id for more information.

Block-level and inline elements


Certain HTML elements that may appear in BODY are said to be "block-level" while others are "inline" (also known as "text level"). The distinction is founded on several notions: Content model Generally, block-level elements may contain inline elements and other block-level elements. Generally, inline elements may contain only data and other inline elements. Inherent in this structural distinction is the idea that block elements create "larger" structures than inline elements. Formatting By default, block-level elements are formatted differently than inline elements. Generally, block-level elements begin on new lines, inline elements do not. For information about white space, line breaks, and block formatting, please consult the section on text. Directionality For technical reasons involving the [UNICODE] bidirectional text algorithm, block-level and inline elements differ in how they inherit directionality information. For details, see the section on inheritance of text direction. Style sheets provide the means to specify the rendering of arbitrary elements, including whether an element is rendered as block or inline. In some cases, such as an inline style

62

for list elements, this may be appropriate, but generally speaking, authors are discouraged from overriding the conventional interpretation of HTML elements in this way. The alteration of the traditional presentation idioms for block level and inline elements also has an impact on the bidirectional text algorithm. See the section on the effect of style sheets on bidirectionality for more information.

7.5.4 Grouping elements: the DIV and SPAN elements


<!ELEMENT DIV - - (%flow;)* -- generic language/style container --> <!ATTLIST DIV %attrs; -- %coreattrs, %i18n, %events -> <!ELEMENT SPAN - - (%inline;)* -- generic language/style container --> <!ATTLIST SPAN %attrs; -- %coreattrs, %i18n, %events -- > Start tag: required, End tag: required Attributes defined elsewhere id, class (document-wide identifiers) lang (language information), dir (text direction) title (element title) style (inline style information) align (alignment) onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events)

The DIV and SPAN elements, in conjunction with the id and class attributes, offer a generic mechanism for adding structure to documents. These elements define content to be inline (SPAN) or block-level (DIV) but impose no other presentational idioms on the content. Thus, authors may use these elements in conjunction with style sheets, the lang attribute, etc., to tailor HTML to their own needs and tastes. Suppose, for example, that we wanted to generate an HTML document based on a database of client information. Since HTML does not include elements that identify objects such as "client", "telephone number", "email address", etc., we use DIV and SPAN to achieve the desired structural and presentational effects. We might use the TABLE element as follows to structure the information: <!-- Example of data from the client database: --> <!-- Name: Stephane Boyera, Tel: (212) 555-1212, Email: sb@foo.org --> <DIV id="client-boyera" class="client"> <P><SPAN class="client-title">Client information:</SPAN>

63

<TABLE class="client-data"> <TR><TH>Last name:<TD>Boyera</TR> <TR><TH>First name:<TD>Stephane</TR> <TR><TH>Tel:<TD>(212) 555-1212</TR> <TR><TH>Email:<TD>sb@foo.org</TR> </TABLE> </DIV> <DIV id="client-lafon" class="client"> <P><SPAN class="client-title">Client information:</SPAN> <TABLE class="client-data"> <TR><TH>Last name:<TD>Lafon</TR> <TR><TH>First name:<TD>Yves</TR> <TR><TH>Tel:<TD>(617) 555-1212</TR> <TR><TH>Email:<TD>yves@coucou.com</TR> </TABLE> </DIV> Later, we may easily add style sheet declarations to fine tune the presentation of these database entries. For another example of usage, please consult the example in the section on the class and id attributes. Visual user agents generally place a line break before and after DIV elements, for instance: <P>aaaaaaaaa<DIV>bbbbbbbbb</DIV><DIV>ccccc<P>ccccc</DIV> which is typically rendered as: aaaaaaaaa bbbbbbbbb ccccc ccccc

Headings: The H1, H2, H3, H4, H5, H6 elements


<!ENTITY % heading "H1|H2|H3|H4|H5|H6"> <!-There are six levels of headings from H1 (the most important) to H6 (the least important). --> <!ELEMENT (%heading;) - - (%inline;)* -- heading -->

64

<!ATTLIST (%heading;) %attrs; -- %coreattrs, %i18n, %events -- > Start tag: required, End tag: required Attributes defined elsewhere id, class (document-wide identifiers) lang (language information), dir (text direction) title (element title) style (inline style information) align (alignment) onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events)

A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically. There are six levels of headings in HTML with H1 as the most important and H6 as the least. Visual browsers usually render more important headings in larger fonts than less important ones. The following example shows how to use the DIV element to associate a heading with the document section that follows it. Doing so allows you to define a style for the section (color the background, set the font, etc.) with style sheets. <DIV class="section" id="forest-elephants" > <H1>Forest elephants</H1> <P>In this section, we discuss the lesser known forest elephants. ...this section continues... <DIV class="subsection" id="forest-habitat" > <H2>Habitat</H2> <P>Forest elephants do not live in trees but among them. ...this subsection continues... </DIV> </DIV> This structure may be decorated with style information such as: <HEAD> <TITLE>... document title ...</TITLE> <STYLE type="text/css"> DIV.section { text-align: justify; font-size: 12pt} DIV.subsection { text-indent: 2em } H1 { font-style: italic; color: green }

65

H2 { color: green } </STYLE> </HEAD> Numbered sections and references HTML does not itself cause section numbers to be generated from headings. This facility may be offered by user agents, however. Soon, style sheet languages such as CSS will allow authors to control the generation of section numbers (handy for forward references in printed documents, as in "See section 7.2"). Some people consider skipping heading levels to be bad practice. They accept H1 H2 H1 while they do not accept H1 H3 H1 since the heading level H2 is skipped.

The ADDRESS element


<!ELEMENT ADDRESS - - (%inline;)* -- information on author --> <!ATTLIST ADDRESS %attrs; -- %coreattrs, %i18n, %events -- > Start tag: required, End tag: required Attributes defined elsewhere id, class (document-wide identifiers) lang (language information), dir (text direction) title (element title) style (inline style information) onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events)

The ADDRESS element may be used by authors to supply contact information for a document or a major part of a document such as a form. This element often appears at the beginning or end of a document. For example, a page at the W3C Web site related to HTML might include the following contact information: <ADDRESS> <A href="../People/Raggett/">Dave Raggett</A>, <A href="../People/Arnaud/">Arnaud Le Hors</A>, contact persons for the <A href="Activity">W3C HTML Activity</A><BR> $Date: 1999/12/24 23:37:50 $ </ADDRESS> previous next contents elements attributes index

66

HTML element
In computing, an HTML element indicates structure in an HTML document and a way of hierarchically arranging content. More specifically, an HTML element is an SGML element that meets the requirements of one or more of the HTML Document Type Definitions (DTDs). These elements have properties: both attributes and content, as specified (both allowable and required) according to the appropriate HTML DTD (for example, the HTML 4.01 strict DTD). Elements may represent headings, paragraphs, hypertext links, lists, embedded media, and a variety of other structures.

Syntactically HTML elements are constructed with: 1) a start tag marking the beginning of an element; 2) any number of attributes (and their associated values); 3) some amount of content (characters and other elements)'; and 4) an end tag. Many HTML elements include attributes in their start tags, defining desired behavior or indicating additional element properties. The end tag is optional for many elements; in a minimal case, an empty element has no content and requires no end tag. There are a few elements that are not part of any official DTDs, yet are supported by some browsers and used by some web pages. Such elements may be ignored or displayed improperly on browsers not supporting them. Informally, HTML elements are sometimes referred to as "tags" (an example of synecdoche), though many prefer the term tag strictly in reference to the semantic structures delimiting the start and end of an element. XHTML is the successor to HTML 4.01; XHTML 1.0 supports the same elements as HTML 4 and in most cases valid XHTML 1.0 documents will be valid or nearly valid HTML 4 documents. XHTML 1.0 migrates HTML from its SGML underpinnings to an XML foundation. Accordingly, the discussion of elements within this article focuses on the final SGML based HTML, version 4.01 (unless noted otherwise). However, to the extent that XHTML 1.0 elements remain identical to the HTML 4.01 elements, the discussion remains applicable (see HTML for a discussion of the minor differences in content between XHTML 1.0 and HTML 4.01).

67

Block-level and inline elements


HTML elements are classified as either block-level or inline (text-level). Block-level elements such as headings, paragraphs, lists, or tables are "large" structures containing other blocks, inline elements, or text (but see nesting rules, below). They are usually displayed as independent "blocks" separated from other blocks by vertical space (margins). Inline or text-level elements such as hyperlinks, citations, quotations, or images are "small" structures that represent or describe small pieces of text or data. They may contain only text or other inline elements, and are usually displayed one after another on a line within the block that contains them.

Nesting of elements
Many HTML elements can be nested, or contained within other HTML elements: <p>You <em>rock</em></p> Nesting can be more complex: <p>King Louis said, <q lang="fr">L'tat, c'est <em>moi</em>!</q> (<cite><a href="/wiki/Louis_XIV_of_France">Wikipedia</a></cite>).</p> Nesting may be arbitrarily deep, but the elements must be closed in the reverse order that they were opened for the code to remain valid (this pattern is known as Last in, first out). Incorrect <p>Mary kissed <em>Jimmy</p></em> Correct <p>Mary kissed <em>Jimmy</em></p> Some block-level elements (e.g. paragraphs) may contain only inline elements, and some (e.g. forms, lists) must contain only block-level child elements, but most may contain either block-level or inline elements.

Document elements
Root elements provide the containers enclosing all other HTML elements. Every HTML page has these elements. The surrounding tags may be omitted. However, some utilities may not recognize or correctly handle the document if this is done.
<html></html>

68

Delimit an HTML document (i.e. instead of an XML or another class document). The HTML element takes the attributes lang for the primary language for the document (such as en for English) and a profile for a URI specifying metadata for the document (rarely used). The only contents allowed in an HTML element is one head element and one body element. (See Frames, below, for an exception where body is not used.)
<head></head>

Delimit the header section of the document, which contains information about the page. The head element basically contains the metadata for the document. There are seven possible head elements including a meta element for extensible specification of metadata.
<body></body>

Delimit the body section of the document, which contains the displayed content of the page. These root elements are arranged as follows: <html> <head> Any of the various head related elements arranged in any order and occurring any number of times except base and title which can only occur once each. Title is the only required head element. </head> <body> At least one of either a block element or a script element must occur,(though any number may occur), arranged in any order to suit the meaning and also typically the presentation of the document. The ins and del elements are also permissible within the body element when used as block level elements. The other block elements are: paragraph (p), heading (h1...h6), block quotation (blockquote), ordered list (ol), unordered list (ul), definition list (dl), division (div), no script support (noscript), form (form), table (table), fieldset (fieldset), and address (address). No other HTML elements are valid within the body element. </body> </html>

Head elements
<title></title>

Define a document title. This element is required in every HTML and XHTML document. Different user agents may make use of the title in different ways. 69

Web browsers usually display it in the title bar when the window is open, and in the task bar when it is minimized. It may become the default filename when saving the page, Search engines' web crawlers may pay particular attention to the words used in the title element. The title element must not contain any nested tags (in other words it cannot contain any other elements). Only one title element is permitted in a document.
<base/>

Specifies a base URL for all relative href and other links in the document. Must appear before any element that refers to an external resource. HTML permits only one base element for each document. The base element has attributes, but no contents.
<link/>

Specifies links to other documents, such as 'previous' and 'next' links, or alternate versions [1]. An HTML head may contain any number of link elements. The link element has attributes, but no contents. A common use is to link to external stylesheets, using the form: <link rel="stylesheet" type="text/css" href="url" title="description of style" />[2]
(deprecated)

Specifies a base font size, typeface and color of the document. Used together with font elements. Deprecated in favor of stylesheets.
<script></script>

Used to add JavaScript or other scripts to the document. The script code may be literally typed between the script tags and/or it may be in a separate resource whose URL is specified in script's optional src attribute. [3] <style></style> Specifies a style for the document, usually: <style type="text/css"></style> The CSS statements may be literally typed between the style tags and/or it may be in separate resources whose URLs are specified in @import directives such as: <style> @import "url"; </style>. [4] <object></object> Use for including generic objects within the head. Though rarely used as a head element, this could potentially be used to extract foreign data, relevant to the document, and associate this data with the current document. 70

<meta/> Can be used to specify author, publication date, expiry date, page description, keywords and any other metadata not provided through the other head elements and attributes. Because of their generic nature, meta elements specify key-value pairs. In one form, meta elements can specify HTTP headers which should be sent before the actual content when the HTML page is served from web server to client. For example: <meta http-equiv="foo" content="bar" /> This example specifies that the page should be served with an HTTP header called 'foo' that has a value 'bar' In the general form, a meta element specifies name and associated content attributes describing aspects of the HTML page. To prevent possible ambiguity, a third optional scheme attribute may be supplied to specify a semantic framework that defines the meaning of the key and its value. For example <meta name="foo" content="bar" scheme="DC" /> In this example, the meta element identifies itself as containing the 'foo' element, with a value of 'bar', from the DC or Dublin Core resource description framework. For more specific information of the use of the meta element in HTML, see the W3C specification.

Inline
Inline elements cannot be placed directly inside the body element for valid HTML. They must be wholly nested within block-level elements (see block elements below).

General phrase elements


<em></em> Emphasis (conventionally displayed in italics) <strong></strong> strong emphasis (conventionally displayed bold). An oral user agent may use different voices for emphasis. <q></q> A quotation containing only inline elements (for quotations containing block level elements see blockquote below). Quote elements may be nested. By the specification, the author should not include quotation marks. Rather, quotation marks including nested quotation marks should be rendered through stylesheet properties or the browser's default stylesheet. Practical concerns due to

71

browser non-compliance may force authors to find work-arounds. The cite attribute gives the source, and must be a fully qualified URI. Note: within semantic HTML, the display of a lengthy inline quotation as an indented block should be handled through stylesheet presentation. One method is to use an XSLT to select quotation elements exceeding a certain length (in terms of characters or words, etc.) for indented block presentation. An alternative, using Cascading Stylesheets, requires some presentational markup to manually classify the element as a lengthy quotation. For example: <q class='lengthy'>An inline quotation of significant length (say 25 words, for example) goes here...</q>. <cite></cite> A citation. Reference for a quote or statement in the document. <dfn></dfn> Defining first instance of a term <abbr></abbr> Contains an abbreviation like HTML <acronym></acronym> Contains an acronym similar to the abbr element.

Computer code phrase elements


These elements are useful primarily for documenting computer code development and user interaction through differentation of source code (<code>), source code variables (<var>), user input (<kbd>), and terminal output (<samp>). <code></code> A code snippet. Conventionally rendered in a monospace font: Code snippet. <samp></samp> Sample output (from a program or script) <kbd></kbd>

72

Keyboard - text to be entered by the user <var></var> Variable

Special inline elements


<sub></sub> <sup></sup> Create subscript or superscript text: Equivalent CSS: {vertical-align: sub} or {vertical-align: super} <del></del> Deleted text. Typically rendered as a strikethrough: <ins></ins> Inserted text. Often used to markup replacement text for <del>'d text. Typically rendered underlined: Inserted text. Note, both ins and del elements may be used as block elements: containing other block and inline elements. However, these elements must still remain wholly within their parent element to maintain a well-formed HTML document). For example deleting text from the middle of one paragraph across several other paragraph and ending in a final paragraph would need to use three separate del elements. Two del elements would be required as inline element to indicate the deletion of text in the first and last paragraphs, and a third, used as a block element, to indicate the deletion in the intervening paragraphs. (deprecated) The :isindex element requires server side support for indexing documents. Visually presents a one-line text input for keyword entry. When submitted, the query string is appended to the current URL and the document is displayed with these keywords highlighted. Generally if the server supports this feature it will add the iisindex elements to documents without author intervention.

Links and anchors


<a></a> Creates an element that becomes a hyperlink with the href attribute set to a URL; additionally the attribute title may be set to a hover box text, some informative text about the link: 73

<a href="URL" title="additional information">link text</a> In most graphical browsers, when the cursor hovers over the link, the cursor typically changes into a hand with a stretched index finger and the additional information pops up, not in a regular window, but in a special "hover box", usually similar to a Tooltip, which disappears when the cursor is moved away. Some browsers render alt text the same way, though this is technically incorrect. Alternatively (and sometimes concurrently), the element becomes an anchor with the name attribute set, which preceded by a number sign '#', and appended to the URL, acts as a link target (a "document fragment"), typically causing a Web browser to scroll directly to that point of the page. Any element can be made into an anchor by using the id attribute, so using <a name="foo"> is not necessary. See also:link

Images and objects


<img/> Includes an image with the src attribute, the required alt provides alternative text in case the image cannot be displayed. Alt is intended as alternative text, although Microsoft Internet Explorer renders it as a tooltip; the title attribute is the tooltip text. <br> <br/> (XML compatible) Specifies a line-break. <map></map> Specifies a client-side image map. <area> <area/> (XML compatible) Specifies an area in the map. <object></object> Includes an object in the page of the type specified by the type attribute. This may be in any MIME-type the Web browser understands, such as an embedded page, code to be handled by a plug-in such as Flash, a Java applet, a sound file, etc. <param></param> or <param/> This element may only appear inside an object element. Using attributes such as name and value, each <param/> sets a parameter for the object. Examples include width, height, font, background colour, etc, depending what has been exposed in this way by the object's developers.

74

<embed></embed> (proprietary) Calls a plug-in handler for the type specified by the type attribute. Used for embedding Flash files, sound files, etc. This is a proprietary Netscape extension to HTML; <object> is the W3C standard method. <noembed></noembed> (proprietary) Specifies alternative content, if the embed cannot be rendered. (deprecated) Includes a Java applet in the page. Deprecated; <object> is now preferred.

Span element
<span></span>

Creates an inline logical division. This may be used to identify a part of the HTML page, for example so as to apply an id or class attribute, which can then be referenced from CSS or DOM call. Like most HTML elements, span also supports inline CSS in its optional style attribute).

Block
Many HTML elements are designed for altering the semantic structure or meaning of a document. Some are block-level, but most are inline and can be included in the normal flow of text.

General block elements


<p></p> Creates a paragraph, perhaps the most common block level element. The closing tag is not required in HTML. <blockquote></blockquote> Contains quoted material when the quotation itself includes block level elements (for instance, quoting several paragraphs). The cite attribute may give the source, and must be a fully qualified Uniform Resource Identifier. The blockquote element is often misunderstood. It is an element meant to contain quotations that are themselves block level. In other words, it contains a complete paragraph or many paragraphs. In HTML strict DTDs inline elements are prohibited from blockquote elements. For quotations not containing block level elements see the quote (q) element. <hr/> Inserts a horizontal rule. Horizontal rules can also be handled through the CSS properties.

Headings
75

<h1></h1> <h2></h2> <h3></h3> <h4></h4> <h5></h5> <h6> </h6> Section headings at different levels. Use <h1> for the highest-level heading (the major sections), <h2> for the next level down (sub-section), <h3> for a level below that, and so on. The lowest level heading is <h6>. Most web browsers will show <h1> as large text in a different font, and <h6> as small bold-faced text, but this can be overridden with CSS. The heading elements are not intended merely for creating large or bold text: they describe something about the document's structure and organization. Some programs use them to generate outlines and tables of contents.

Tables
<table></table> Creates a table <tr></tr> Creates a row in the table. <th></th> Creates a table header cell within a row; contents are conventionally displayed bold and centered. An aural user agent may use a louder voice for these items. <td></td> Creates a table data cell within a row. <colgroup></colgroup> Specifies a column group in a table. <col/> Specifies attributes for an entire column in a table. <caption></caption> Specifies a caption for the entire table. <thead></thead> Specifies the header part of a table. This section may be repeated by the user agent if the table is split across pages (in printing or other paged media). <tbody></tbody> Specifies the main part of a table. <tfoot></tfoot> Specifies the footer part of a table. Like <thead>, this section may be repeated by the user agent if the table is split across pages (in printing or other paged media)

Forms
These elements can be combined into a form or used separately as user-interface controls. Combined with a first-class javascript engine, these controls provide support for rich user interfaces. Main article: HTML form

76

HTML specifies the elements that make up a form, and the method by which it will be submitted. However, some form of script either server-side or client side must be used to process the user's input once it is submitted. <form action="url"></form> Creates a form. <select name="xyz"></select> Create a menu list, from which the user can select a single option. May be rendered as a dropdown menu. <option value="x"/> Creates a menu item in a menu list. <input type="checkbox"/> Creates a checkbox. Can be checked or unchecked. <input type="radio"/> Creates a radio button. If multiple radio buttons are given the same name, the user will only be able to select one of them from this group. <input type="button"/> Creates a general-purpose button. But it's advised to use <button> if possible (i.e. if the client supports it) which provides richer possibilities. <input type="submit"/> Creates a submit button. <input type="image"/> Creates a button using an image. The image URL may be specified with the src tag. <input type="reset"/> Creates a reset button for resetting the form to default values. <input type="text"/>

77

Creates a one-line text input. The size attribute specifies the default width of the input in character-widths. Maxlength sets the maximum number of characters the user can enter (which may be greater than size). <input type="password"/> Creates a variation of one-line text input. The only difference is that inputted text is masked: usually every character is shown as an asterisk or a dot. It should be noted, however, that the value is submitted to the server as clear text. So an underlying secure transport layer like HTTPS is needed if confidentiality is a matter. <label for="name"></label> Creates a label for a form input (e.g. radio button). Clicking on the label toggles the control. <textarea rows="8"></textarea> Create a multiple-line text area, the size of which is specified by cols and rows attributes. Text in between the tags appears in the text area when the page is loaded.

Frames
An HTML document may contain a header and a body or a header and a frameset, but not both. For frames the Frames DTD must be used. <frameset></frameset> Delimit the frameset. The frames layout is given by comma separated lists in the rows and cols attributes. <frame></frame> Delimit a single frame, or region, within the frameset. A different document linked with the src attribute appears inside. <noframes></noframes> Contains a normal <body> element with child elements that will appear in web browsers that don't support frames. <iframe></iframe> An inline frame inside a normal HTML <body>, which embeds another HTML document. A similar effect can also be achieved using the object element. These approaches differ in some ways (World Wide Web Consortium [5]). See also Framing (World Wide Web).

Presentational markup
78

Official
The use of presentational markup is discouraged. The equivalent CSS should be used instead. Deprecated elements are only valid in the Transitional and Frameset variants of HTML 4.01 and XHTML1.0. They are invalid in the Strict variants of HTML 4.01, XHTML1.0 and XHTML 1.1. <b></b> and <i></i> are invalid in the current draft of XHTML2.0. (deprecated) Creates a block-level centered division. May also center-align all text. Deprecated in favor of <div> or another element with centering defined using CSS. <b></b> Use boldface type. Equivalent CSS: {font-weight: bold} <i></i> Use italic type. Equivalent CSS: {font-style: italic} <big></big> Creates bigger text. Equivalent CSS: {font-size: larger}. <small></small> Creates smaller text. Equivalent CSS: {font-size: smaller} (deprecated)
(deprecated)

Create strike-through text: Strikethrough Equivalent CSS: {textdecoration: line-through} <tt></tt> Use a typewriter-like (fixed-width) font. Equivalent CSS: {font-family:
monospace} (deprecated) (deprecated)

Use an underlined font. Equivalent CSS: {text-decoration: underline}

<font [color=color,] [size=size,] [face=face]></font> Can specify the font color with the color attribute, typeface with the face attribute, and absolute or relative size with the size attribute. Examples (all the examples are deprecated, use CSS equivalents if possible): 1. <font color="green">text</font> creates green text. See template:fontcolor. 2. <font color="#1f4099">text</font> creates text with hexadecimal color #1f4099. 3. <font size="4">text</font> creates text with size 4. Sizes are from 1 to 7. The standard size is 3, unless otherwise specified in the <body> or other tags. 4. <font size="+1">text</font> creates text with size 1 bigger than the standard.. <font size="-1">text</font> is opposite. 5. <font face="Courier">text</font> makes text with Courier font. 79

Equivalent CSS for font attributes: <font size="N"> corresponds to {font-size: Yunits} (the HTML specification does not define the relationship between size N and unit-size Y, nor does it define a unit). <font color="red"> corresponds to {color: red} <font face="Courier"> corresponds to {font-family: Courier}

Unofficial
These are unofficial presentational elements that may not be supported in all browsers. <blink></blink> (unofficial) Causes text to blink. Can be done with CSS where supported: {textdecoration: blink} <marquee></marquee> (unofficial) Creates scrolling text. No equivalent with CSS; use scripting instead. <nobr></nobr> (unofficial) Causes text to not return at end of line. Can be done with CSS: {whitespace: nowrap}

HTML Comment
<!----> Encloses a comment. This is an SGML tag and not limited to HTML, so it may appear anywhere in the document, even before the DTD or after </html>. A client should render none of its enclosed contents. The closing ">" is required. For compatibility with some pre-1995 browsers, SGML comments are sometimes used inside <style> or <script> tags, but this is not necessary and may in fact cause undesired effects.

80

Relationship to URL and URN

Venn diagram of Uniform Resource Identifier (URI) scheme categories. Schemes in the URL (locator) and URN (name) categories both function as resource IDs, so URL and URN are subsets of URI. They are also, generally, disjoint sets. However, many schemes can't be categorized as strictly one or the other, because all URIs can be treated as names, and some schemes embody aspects of both categories or neither. A URI can be classified as a locator or a name or both. A Uniform Resource Locator (URL) is a URI that, in addition to identifying a resource, provides means of acting upon or obtaining a representation of the resource by describing its primary access mechanism or network "location". For example, the URL http://www.wikipedia.org/ is a URI that identifies a resource (Wikipedia's home page) and implies that a representation of that resource (such as the home page's current HTML code, as encoded characters) is obtainable via HTTP from a network host named www.wikipedia.org. A Uniform Resource Name (URN) is a URI that identifies a resource by name in a particular namespace. A URN can be used to talk about a resource without implying its location or how to dereference it. For example, the URN urn:isbn:0-395-36341-1 is a URI that, like an International Standard Book Number (ISBN), allows one to talk about a book, but doesn't suggest where and how to obtain an actual copy of it. The contemporary point of view among the working group that oversees URIs is that the terms URL and URN are context-dependent aspects of URIs, and rarely need to be distinguished.[1] In technical publications, especially standards produced by the IETF and the W3C, the term URL has long been deprecated, as it is rarely necessary to distinguish between URLs
81

and URIs. However, in nontechnical contexts and in software for the World Wide Web, the term URL remains ubiquitous. Additionally, the term web address, which has no formal definition, is often used in nontechnical publications as a synonym for URL or URI, although it generally refers only to 'http' and 'https' URIs.

Syntax
The URI syntax is essentially a URI scheme name like "http", "ftp", "mailto", "urn", "mms", "rtsp", etc., followed by a colon character, and then a scheme-specific part. The syntax and semantics of the scheme-specific part are determined by the specifications that govern the schemes, although the URI syntax does force all schemes to adhere to a certain generic syntax that, among other things, reserves certain characters for special purposes, without always saying what those purposes are. The URI syntax also enforces restrictions on the scheme-specific part, in order to, for example, provide for a degree of consistency when the part has a hierarchical structure. Percentencoding is an often misunderstood aspect of URI syntax.

History
Naming, addressing, and identifying resources
URIs and URLs have a shared history. The idea of a URL a short string representing a resource that is the target of a hyperlink was implicitly introduced in late 1990 in Tim Berners-Lee's proposals for HyperText [1]. At the time, it was called a hypertext name or document name[2] Over the next three-and-a-half years, as the World Wide Web's core technologies of HTML (the HyperText Markup Language), HTTP, and Web browsers were developed, a need to distinguish between strings that provide an address for resources and those that merely name resources emerged. Although not yet formally defined, the term Uniform Resource Locator came to represent strings used for the former purpose, and the more contentious Uniform Resource Name came to represent strings used for the latter purpose. During the debate over how to best define URLs and URNs, it became evident that the two concepts embodied by the terms were merely aspects of
82

the fundamental, overarching notion of resource identification. So, in June 1994, the IETF published Berners-Lee's RFC 1630: the first RFC that (in its non-normative text) acknowledged the existence of URLs and URNs, and, more importantly, defined a formal syntax for Universal Resource Identifiers URL-like strings whose precise syntax and semantics were dependent upon their scheme. In addition, this RFC attempted to summarize the syntax of URL schemes that were in use at the time. It also acknowledged, but did not standardize, the existence of relative URLs and fragment identifiers.

Refinement of specifications
In December 1994, RFC 1738 was published in order to formally define relative and absolute URLs, refine the general URL syntax, define how relative URLs were to be resolved to absolute form, and better enumerate the URL schemes that were in use at the time. The definition and syntax of URNs was not settled upon until the publication of RFC 2141 in May 1997. With the publication of RFC 2396 in 1998, the URI syntax became a separate specification, and most parts of RFCs 1630 and 1738 became obsolete. In the new RFC, the "U" in "URI" was changed to represent "Uniform" rather than "Universal", and all parts of RFCs 1630 and 1738 relating to URIs and URLs in general were revised and expanded. Only those portions of RFC 1738 that summarized existing URL schemes were not rendered obsolete by RFC 2396. In December 1999, RFC 2732 provided a minor update to RFC 2396, allowing URIs to accommodate IPv6 addresses. Some time later, a number of shortcomings discovered in the two specifications led to the development of a number of draft revisions under the title rfc2396bis. This community effort, coordinated by RFC 2396 co-author Roy Fielding, culminated in the publication of RFC 3986 in January 2005. This RFC is the current version of the URI syntax recommended for use on the Internet, and it renders RFC 2396 obsolete. It does not, however, render the details of existing URL schemes obsolete; those are still governed by RFC 1738, except where otherwise superseded RFC 2616 for example, refines the "http" scheme. The content of RFC 3986 was simultaneously published by the IETF as the full standard STD 66, reflecting the establishment of the URI generic syntax as an official Internet protocol.
83

In August 2002, RFC 3305 pointed out that the term URL has, despite its ubiquity in the vernacular of the Internet-aware public at large, faded into near-obsolescence. It now serves only as a reminder that some URIs act as addresses because they have schemes that imply some kind of network accessibility, regardless of whether they are actually being used for that purpose. As URI-based standards such as Resource Description Framework make evident, resource identification need not be coupled with the retrieval of resource representations over the Internet, nor does it need to be associated with network-bound resources at all.

URI reference
A URI reference is another type of string that represents a URI, and, in turn, the resource identified by that URI. The distinction between a URI and a URI reference is not often maintained in informal usage, but protocol documents should not allow for ambiguity. A URI reference may take the form of a full URI, or just the schemespecific portion of one, or even some trailing component thereofeven the empty string. An optional fragment identifier, preceded by "#", may be present at the end of a URI reference. The part of the reference before the "#" indirectly identifies a resource, and the fragment identifier identifies some portion of that resource. In order to derive a URI from a URI reference, the URI reference is converted to "absolute" form by merging it with an absolute "base" URI, according to a fixed algorithm. The URI reference is considered to be relative to the base URI, although if the reference itself is absolute, then the base is irrelevant. The base URI is typically the URI that identifies the document containing the URI reference, although this can be overridden by declarations made within the document or as part of an external data transmission protocol. If a fragment identifier is present in the base URI, it is ignored during the merging process. If a fragment identifier is present in the URI reference, it is preserved during the merging process. In web document markup languages, URI references are frequently used in places where there is a need to point to other resources, such as external documents or specific portions of the same logical document.

Uses of URI references in markup languages


84

In HTML, the value of the src attribute of the img element is a URI reference, as is the value of the href attribute of the a or link element. In XML, the system identifier appearing after the SYSTEM keyword in a DTD is a fragmentless URI reference; In XSLT, the value of the href attribute of the xsl:import element/instruction is a URI reference, as is the first argument to the document() function.

Examples of absolute URIs


http://somehost/absolute/URI/with/absolute/path/to/resource.txt ftp://somehost/resource.txt urn:issn:1535-

Examples of URI references


http://example/resource.txt#frag01 http://somehost/absolute/URI/with/absolute/path/to/resource.txt /relative/URI/with/absolute/path/to/resource.txt relative/path/to/resource.txt ../../../resource.txt resource.txt /resource.txt#frag01 #frag01 (empty string)

URI resolution
To "resolve" a URI means either to convert a relative URI reference to absolute form, or to dereference a URI or URI reference by attempting to obtain a representation of the resource that it identifies. The "resolver" component in document processing software generally provides both services. A URI reference may be considered to be a same-document reference: a reference to the document containing the URI reference itself. Document processing software is encouraged to use its current representation of the document to satisfy the resolution of a same-document reference; a new representation should not be fetched. This is only a recommendation, and
85

document processing software is free to use other mechanisms to determine whether obtaining a new representation is warranted. According to the current URI specification, RFC 3986, a URI reference is a same-document reference if, when resolved to absolute form, it is identical to the base URI that is in effect for the reference. Typically, the base URI is the URI of the document containing the reference. XSLT 1.0, for example, has a document() function that, in effect, implements this functionality. RFC 3986 also formally defines URI equivalence, which can be used in order to determine that a URI reference, while not identical to the base URI, still represents the same resource and thus can be considered to be a same-document reference. Same-document references were determined differently according to RFC 2396, which was made obsolete by RFC 3986 but is still used as the basis of many specifications and implementations. According to this specification, a URI reference is a same-document reference if it is an empty string or consists of only the "#" character followed by an optional fragment.

Relation to XML namespaces


XML has a concept of a namespace, an abstract domain to which a collection of element and attribute names can be assigned. An XML namespace is identified by a character string, the namespace name, which must adhere to the generic URI syntax. However, the namespace name is not considered to be a URI because the "URI-ness" of strings is, according to the URI specification, based on how they are intended to be used, not just their lexical components. A namespace name also does not necessarily imply any of the semantics of URI schemes; a namespace name beginning with "http:", for example, likely has nothing to do with the HTTP protocol. There has been much debate about this among XML professionals on the xml-dev electronic mailing list; some feel that a namespace name could be a URI, since the collection of names comprising a particular namespace could be considered to be a resource that is being identified, and since the Namespaces in XML specification says that the namespace name is a URI reference. The consensus seems to be, though, that a namespace name is just a string that happens to look like a URI, nothing more. Initially, the namespace name was allowed to match the syntax of any non-empty URI reference, but the use of relative URI references was later
86

deprecated by an erratum to the Namespaces In XML Recommendation. A separate specification was issued for namespaces for XML 1.1, and allows IRI references, not just URI references, to be used as the basis for namespace names. In order to mitigate the confusion that began to arise among newcomers to XML from the use of URIs (particularly HTTP URLs) for namespaces, a descriptive language called RDDL was developed. An RDDL document can provide machine- and human-readable information about a particular namespace and about the XML documents that use it. XML document authors were encouraged to put RDDL documents in locations such that if a namespace name in their document was somehow dereferenced, then an RDDL document would be obtained, thus satisfying the desire among many developers for a namespace name to point to a network-accessible resource. The standard pronunciation of URL is as an initialism (U-R-L), but some people pronounce URL as an acronym (Earl). A popular synonym for "URI" The idea of a uniform syntax for global identifiers of networkretrievable documents was the core idea of the World Wide Web. In the early times, these identifiers were variously called "document names", "Web addresses" and "Uniform Resource Locators". But these names were misleading, since not all identifiers were locators, and even for those that were it was not the defining characteristics. But, by the time the RFC 1630 formally defined the term URI as a generic term best suited for the concept, the term "URL" gained widespread popularity, which has continued to this day.

URI/URL syntax in brief


Main article: URI scheme#Generic syntax

87

Here is a typical URI dissected: http://user:pass@example.com:992/animal/bird? species=seagull#wings \___/ \_______/ \_________/ \_/\__________/\______________/\____/ | | | | | | protocol login host port path anchor/fragment

| query

Every URI (and therefore every URL) begins with the scheme name which defines its namespace, purpose and syntax of the remaining part of the URI. Most Web-enabled programs will try to dereference a URI according to the semantics of its scheme and a context-specific heuristics. For example, a Web browser will usually dereference a http://example.org/ by performing a HTTP request to the host example.org, at the default HTTP port. Dereferencing URI mailto:bob@example.com will usually open a "Compose e-mail" window with the address bob@example.com in the "To" field. "example.com" is a domain name; an IP address or other network address might be used instead.

URLs as locators
In its current strict technical meaning, a URL is a URI which, in addition to identifying a resource, [provides] a means of locating the resource by describing its primary access mechanism (e.g., its network location).

Clean URLs
Clean URLs are URLs used by dynamic web pages yet look as if they were static web pages because they are free from any parameters. They are also free from filename extensions, thus hiding the type of server side technology used in the web application.

URI scheme

88

A URI scheme is the top level of the URI (Uniform Resource Identifier) naming structure. All URIs and absolute URI references are formed with a scheme name, followed by a colon character, and the remainder of the URI called (in the outdated RFCs 1738 and 2396, but not the current STD 66/RFC 3986) the scheme-specific part. The syntax and semantics of the scheme-specific part are left largely to the specifications governing individual schemes, subject to certain constraints such as reserved characters and how to "escape" them. URI schemes are sometimes erroneously referred to as "protocols", or specifically as URI protocols or URL protocols, since most were originally designed to be used with a particular protocol, and often have the same name. The http: scheme, for instance, is generally used for interacting with Web resources using HyperText Transfer Protocol. Today, URIs with that scheme are also used for other purposes, such as RDF resource identifiers and XML namespaces, that are not related to the protocol. Furthermore, some URI schemes are not associated with any specific protocol (e.g. "file:") and many others do not use the name of a protocol as their prefix (e.g. "news:"). URI schemes should be registered with IANA, although many nonregistered schemes are used in practice. RFC 2717 describes the procedures for registering new URI schemes. RFC 2718 provides guidelines for the development of new URI schemes. Both of these RFCs are currently undergoing revision.

Generic syntax
Internet standard STD 66 (also RFC 3986) defines the generic syntax to be used in all URI schemes. Every URI is defined as consisting of four parts, as follows: <scheme name> : <hierarchical part> [ ? <query> ] [ # <fragment> ] The scheme name consist of a letter followed by any combination of letters, digits, and the plus ("+"), period ("."), or hyphen ("-") characters; and is terminated by a colon (":").

89

The hierarchical part of the URI is intended to hold identification information hierarchical in nature. Usually this part begins with a double forward slash ("//"), followed by an authority part and an optional path. The authority part holds an optional user information part terminated with "@" (e.g. username:password@), a hostname (i.e. domain name or IP address), and an optional port number preceded by a colon ":". The path part is a sequence of segments (conceptually similar to directories, though not necessarily representing them) separated by a forward slash ("/"). Each segment can contain parameters separated from it using a semicolon (";"), though this is rarely used in practice. The query is an optional part separated with a question mark, which contains additional identification information which is not hierarchical in nature. Its syntax is not generically defined, but is commonly organized as a sequence of <key>=<value> pairs separated by an ampersand, e. g. key1=value1&key2=value2&key3=value3. The fragment is an optional part separated from the front parts by a hash ("#"). It holds additional identifying information which allows indirect identification of a secondary resource, e.g. a section heading in an article identified by the remainder of the URI.

Examples
The following are two example URIs and their component parts (taken from STD 66): foo://example.com:8042/over/there?name=ferret#nose \_/ \______________/\_________/ \_________/ \__/ | | | | | scheme authority path query fragment | _____________________|__ / \ / \ urn:example:animal:ferret:nose

Domain name

90

The term domain name has multiple related meanings: A name that is entered into a computer (e.g. as part of a Web site or other URL, or an e-mail address) then looked up in the global Domain Name System (DNS) which informs the computer of the IP address(es) assigned to that name. The product that registrars provide to their customers. A name looked up in the DNS for other purposes.

They are sometimes colloquially (and incorrectly) referred to by marketers as "Web addresses". The authoritative definition is that given in the RFCs that define the DNS.

Domain names are hostnames that provide more memorable names to stand in for numeric IP addresses. They allow for any service to move to a different location in the topology of the Internet (or another internet), which would then have a different IP address. Each string of letters, digits and hyphens between the dots is called a label in the parlance of the domain name system (DNS). Valid labels are subject to certain rules, which have relaxed over the course of time. The original rules state that labels must start with a letter, and end with a letter or digit; any intervening characters may be letters, digits, or hyphens. Labels must be between 1 and 63 characters long (inclusive). Letters are ASCII A Z and az; domain names are compared case-insensitively. Later it became permissible for labels to commence with a digit (but not for domain names to be entirely numeric), and for labels to contain internal underscores, but support for such domain names is uneven. These are the rules imposed by the way names are looked up ("resolved") by DNS. Some top level domains impose more rules, such as a longer minimum length, on some labels. Fully qualified domain names (FQDNs) are sometimes written with a final dot. By making possible the use of unique alphabetical addresses instead of numeric ones, domain names allow Internet users to easily find and communicate with Web sites and other server-based services. The flexibility of the domain name system allows multiple IP addresses to be assigned to a single domain name, or multiple domain names to be assigned to a single IP address. This means that one server may have multiple roles (such as hosting multiple independent Web sites), or one role can be spread among many
91

servers. One IP address can even be assigned to several servers, such as with anycast and hijacked IP space. Examples The following example illustrates the difference between a URL (Uniform Resource Locator) and a domain name: URL: http://www.example.com/ Domain name: example.com As a general rule, the IP address and the server name are interchangeable. For most Internet services, the server will not have any way to know which was used. However, the explosion of interest in the Web means that there are far more Web sites than servers. To accommodate this, the hypertext transfer protocol (HTTP) specifies that the client tells the server which name is being used. This way, one server with one IP address can provide different sites for different domain names. This feature goes under the name virtual hosting and is commonly used by Web hosts. For example, the server at 192.0.34.166 handles all of the following sites: example1.com example2.net example3.org When a request is made, the data corresponding to the hostname requested, is served to the user.

Top-level domains
Every domain name ends in a top-level domain (TLD) name, which is always either one of a small list of generic names (three or more characters), or a two characters territory code based on ISO-3166 (there are few exceptions and new codes are integrated case by case). Top-level domains are sometimes also called first-level domains.

Other-level domains
In addition to the top-level domains, there are second-level domain (SLD) names. These are the names directly to the left of .com, .net, and the
92

other top-level domains. As an example, in the domain en.wikipedia.org, " is the second-level domain. On the next level are third-level domains. These domains are immediately to the left of a second-level domain. In the en.wikipedia.org example, "en" is a third-level domain. Domains of third or higher level are also known as subdomains, though this term technically applies to a domain of any level, since even a top-level domain is a "subdomain" of the "root" domain (a "zeroth-level" domain that is designated by a dot alone).

Official assignment
ICANN (Internet Corporation for Assigned Names and Numbers) has overall responsibility for managing the DNS. It controls the root domain, delegating control over each top-level domain to a domain name registry. For ccTLDs, the domain registry is typically controlled by the government of that country. ICANN has a consultation role in these domain registries but is in no position to regulate the terms and conditions of how a domain name is allocated or who allocates it in each of these country level domain registries. On the other hand, generic top-level domains (gTLDs) are governed directly under ICANN which means all terms and conditions are defined by ICANN with the cooperation of the gTLD registries. Domain names which are theoretically leased can be considered in the same way as real estate, due to a significant impact on online brand building, advertising, search engine optimization, etc. A few companies have offered low-cost, below-cost or even free domain registrations, with a variety of models adopted to recoup the costs to the provider. These usually require that domains are hosted on their site in a framework or portal, with advertising wrapped around the user's content, revenue from which allows the provider to recoup the costs. When the DNS was new, domain registrations were free. A domain owner can generally give away or sell infinite subdomains of their domain, e.g. the owner of example.edu could provide domains that are subdomains, such as foo.example.edu and foo.bar.example.edu.

Uses and abuses


93

As domain names became attractive to marketers, rather than just the technical audience for which they were originally intended, they began to be used in manners that in many cases did not fit in their intended structure. As originally planned, the structure of domain names followed a strict hierarchy in which the top level domain indicated the type of organization (commercial, governmental, etc.), and addresses would be nested down to third, fourth, or further levels to express complex structures, where, for instance, branches, departments, and subsidiaries of a parent organization would have addresses which were subdomains of the parent domain. Also, hostnames were intended to correspond to actual physical machines on the network, generally with only one name per machine. However, once the World Wide Web became popular, site operators frequently wished to have memorable addresses, regardless of whether they fit properly in the structure; thus, since the .com domain was the most popular and memorable, even noncommercial sites would often get addresses under it, and sites of all sorts wished to have second-level domain registrations even if they were parts of a larger entity where a logical subdomain would have made sense (e.g., abcnews.com instead of news.abc.com). A Web site found at http://www.example.org will often be advertised without the "http://", and in most cases can be reached by just entering "example.org" into a Web browser. In the case of a .com, the Web site can sometimes be reached by just entering "example" (depending on browser versions and configuration settings, which vary in how they interpret incomplete addresses). The popularity of domain names also led to uses which were regarded as abusive by established companies with trademark rights; this was known as cybersquatting, in which somebody took a name that resembled a trademark in order to profit from traffic to that address. To combat this, various laws and policies were enacted to allow abusive registrations to be forcibly transferred, but these were sometimes themselves abused by overzealous companies committing reverse domain hijacking against domain users who had legitimate grounds to hold their names, such as their being generic words as well as trademarks in a particular context, or their use in the context of fan or protest sites with free speech rights of their own. Laws that specifically address domain name conflicts include the Anticybersquatting Consumer Protection Act in the United States and the
Trademarks Act, 1999, in India.

94

Generic domain names problems arising out of unregulated name selection


Within a particular top-level domain, parties are generally free to select an unallocated domain name as their own on a first come, first served basis. For generic or commonly used names, this may sometimes lead to the use of a domain name which is inaccurate or misleading. This problem can be seen with regard to the ownership or control of domain names for a generic product or service. By way of illustration, there has been tremendous growth in the number and size of literary festivals around the world in recent years. In this context, currently a generic domain name such as literary.org is available to the first literary festival organisation which is able to obtain registration, even if the festival in question is very young or obscure. Some critics would argue that there is greater amenity in reserving such domain names for the use of, for example, a regional or umbrella grouping of festivals. Related issues may also arise in relation to non-commercial domain names.

Unconventional domain names


Due to the rarity of one-word dot-com domain names, many unconventional domain names, domain hacks, have been gaining popularity. They make use of the top-level domain as an integral part of the Web site's title. Two popular domain hack Web sites are del.icio.us and blo.gs, which spell out "delicious" and "blogs", respectively. Unconventional domain names are also used to create unconventional email addresses. Non-working examples that spell 'James' are j@m.es and j@mes.com, which use the domain names m.es (of Spain's .es) and mes.com, respectively.

Commercial resale of domain names


An economic effect of the widespread usage of domain names has been the resale market for generic domain names that has sprung up in the last decade. Certain domains, especially those related to business, gambling, pornography, and other commercially lucrative fields of digital world trade have become very much in demand to corporations and entrepreneurs due to
95

their intrinsic value in attracting clients. The most expensive Internet domain name to date, according to Guinness World Records, is business.com which was resold in 1999 for $7.5 million, but this was $7.5 million in stock options, not in cash. Later the stock was valued at, not sold, for $2 million and may even be worth less today Newsweek [1]. There are disputes about the high values of domain names claimed and the actual prices of many sales. Another high value domain name, sex.com, was stolen from its rightful owner by means of a forged transfer instruction via fax. During the height of the dot-com era, the domain was earning millions of dollars per month in advertising revenue from the large influx of visitors that arrived daily. Two long-running U.S. lawsuits resulted, one against the thief and one against the domain registrar VeriSign[2]. In one of the cases, Kremen v. Network Solutions, the court found in favor of the plaintiff, leading to an unprecedented ruling that classified domain names as property, granting them the same legal protections. In 1999, Microsoft traded the valuable name Bob.com with internet entrepreneur Bob Kerstein for the name Windows2000.com which was the name of their new operating system.[3] One of the reasons for the value of domain names is that even without advertising or marketing, they attract clients seeking services and products who simply type in the generic name. Furthermore, generic domain names such as movies.com or Books.com are extremely easy for potential customers to remember, increasing the probability that they become repeat customers or regular clients. Although the current domain market is nowhere as strong as it was during the dot-com heyday, it remains strong and is currently experiencing solid growth again. Annually tens of millions of dollars change hands due to the resale of domains. Large numbers of registered domain names lapse and are deleted each year. On average 25,000 domain names drop (are deleted) every day. People who buy and sell domain names are known as domainers.

MIME
Multipurpose Internet Mail Extensions (MIME) is an Internet Standard that extends the format of e-mail to support text in character sets
96

other than US-ASCII, non-text attachments, multi-part message bodies, and header information in non-ASCII character sets. Virtually all human-written Internet e-mail and a fairly large proportion of automated e-mail is transmitted via SMTP in MIME format. Internet e-mail is so closely associated with the SMTP and MIME standards that it is sometimes called SMTP/MIME e-mail. The content types defined by MIME standards are also of importance outside of e-mail, such as in communication protocols like HTTP for the World Wide Web. HTTP requires that data be transmitted in the context of e-mail-like messages, even though the data may not actually be e-mail.
1. What is HTML? 2. Why should you be concerned about differences in HTML standards? 3. What are HTML tags? 4. Where is the text of the title tag displayed? 5. What steps are involved in creating a simple HTML document? 6. How do you create a comment tag? 7. How can you display your HTML document in a web browser? 8. What is the HTML tag for a paragraph break? 9. What steps did you use for inserting a paragraph break in your document? 10. How did you display and view the changes in your web browser? 11. * Extra Credit: What is a horizontal rule <hr> tag? a <br> tag? 12. What are HTML style tags? 13. What are the different tags used for different styles of text? 14. What steps did you use in entering styled text into your HTML document? 15. *Extra Credit: How can these styles be useful in creating a web page or lesson? 16. How are lists valuable in a web page? 17. What is the HTML tag for a unordered list? 18. What is the tag for a ordered list? 19. How might you set up a nested list? 20. What steps did you use in adding a list to your HTML document? 21. What are the two graphic formats used for the World Wide Web? 22. How can a graphic file display on different computers? 23. What are some key points to consider when including graphics in web pages? 24. How did you save the lava graphic for use in your WWW document?

97

7a. Inline Graphics


WWW Mathematics: Text + Pictures = Multimedia Multimedia + WWW = Global HyperMedia After this lesson, you will be able to: Place an inline image within your HTML document. Select how the pictures align with surrounding text. Modify the inline image tag to account for viewers using a non-graphic browser. Specify the dimensions of inline image.

Let's see how with HTML you can include pictures like the "Big M" in a web page...

HTML Tags for Inline Graphics


An "inline" image is one that appears within the text of a WWW page, such as

this picture of "Big M". The HTML format for the inline image tag is: <img src="filename.gif"> where filename.gif is the name of a GIF file that resides in the same directory/folder as your HTML document. By "inline", this means that a web browser will display the image in between text. Note how the text immediately follows the "Big M" above. What if we want the "Big M" sitting on its very own line? To force the image to appear on a separate line,

simply insert a paragraph tag before the image tag: 98

<p> <img src="filename.gif">

Alignment of Text and Inline Graphics


With an attribute to the <img...> tag, you can also control how text adjacent to the image aligns with the picture. The align attribute, added inside the <img> tag, can produce the following effects:
align=top

<img align=top src="filename.gif">

is for Maricopa Community Colleges located in the Valley of the Sun, metropolitan Phoenix, Arizona. Our license plates say that we are the Grand Canyon State...

align=middle <img align=middle src="filename.gif">

is for Maricopa Community Colleges located in the Valley of the Sun, metropolitan Phoenix, Arizona. Our license plates say that we are the Grand Canyon State...

align=bottom (default) <img align=bottom src="filename.gif">

is for Maricopa Community Colleges located in the

99

Valley of the Sun, metropolitan Phoenix, Arizona. Our license plates say that we are the Grand Canyon State... In this exercise, you will add an introductory picture of a volcano to your lesson. 1. 2. 3. 4. Re-open your workspace (if not already open). Open your volc.html document with the text editor. Above the <h1>Volcano Web</h1> heading, enter the following: <img src="lava.gif">

This HTML format will insert, at the very top of your page, the lava picture that 5. Save and reload in your web browser.

In placing the image, you may have wondered why we did not need to put a <p> tag after the image. This is because the following text was a header. A web browser always inserts a paragraph break before and after an <h1,h2,h3...> tag.

The alt="..." attribute


If your web pages will be viewed by users using a text-only browser (such as lynx), they will not be able to view any inline images. Or sometimes, users will turn off the loading of inline images to save time on downloading over slow network connections. An attribute for the <img ...> tag allows for substitution of a descriptive string of text to hold the place of the image. Under these conditions, a viewer with a text browser will see a place holder so that the top of our lesson page looks like:

[IMAGE] Volcano Web In this lesson you will use the Internet to research information on volcanoes and then write a report on your results. In this Lesson...

-----------------------------------------------------------------

This lets the viewer know that there is a graphic inserted at the top of this page. You could modify the <img> tag so that rather than using the place holder, it displays a text string. For example, in our lesson we could add "A Lesson on:" by modifying the <img> to read: <img alt="A Lesson on:" src="lava.gif"> 100

The alt="..." attribute replaces the place holder with a text string so that from a textonly browser (or when loading of images is shut off), it would now appear:

A Lesson On Volcano Web In this lesson you will use the Internet to research information on volcanoes and then write a report on your results. ---------------------------------------------------------------In this Lesson...

At this time, make this same edit to your HTML file for the <img> tag that displays the picture of the volcano.

Height and Width attributes


Another option you may want to include in your <img...> tags are two attributes that give the dimensions of the image in pixels. Why? Normally, your web browser has to determine these dimensions as it reads in the image; the loading of your page can be faster if you specify these numbers in your HTML. The format for including this option is: <img src="filename.gif" width=X height=Y > where X is the width of the image and Y is the height of the image in pixels. You can usually use some sort of graphics program or utility to determine these numbers. Another way to find the dimensions of an image is to load it into your web browser -- you may be able to drag and drop the icon for the image into your browser window -- and the height and width will be displayed in the title bar of the browser. For our example in this lesson, the lava.gif image is 300 pixels wide and 259 pixels high. So you should edit your volc.html file to read: <img alt="A Lesson on:" src="lava.gif" width=300 height=259> NOTE: the order of the attributes inside the <img> tag does not matter. Often we are asked if you can alter the size of the image by inserting numbers other than the actual dimensions of the image. The answers is yes but the results may be undesirable. If you insert larger numbers (to make the image bigger) the result will be a "blocky" picture. Sometimes this can be a useful effect on images with large areas of 101

solid color. Take a look at our example of Going from Small to Big. If you use lower numbers (to make the image smaller) the result may be a distorted picture. Also, the full size image still has to be downloaded, so there is no real savings in terms of time to download the image. Any re-sizing of the image requires extra "work" by the web browser to recalculate the page layout. You could experiment and see for yourself. We just might be wrong! You can also specify the size of an inline image in dimensions that are percentages of the current browser window size, so that the image will resize itself if the viewer expands or reduces the size of their browser window. Take a look at our example of Percentage Scaling. Caveat Emptor! This may not work on all web browsers!

Independent Practice
Add an inline image to your web page using a GIF picture file that is stored on your computer or one that you have downloaded from the Internet.

Review Topics
1. What is the HTML format for an inline image? 2. What type of tag must you put before an image tag to make the image appear on a separate line? 3. How did you add the lava picture to your document? 4. What does the alt="...." attribute do? What does the height="...." attribute do?

102

8. Linking it with Anchors


Relax... this lesson is quick and easy! In fact, it is just information for you to read...

What is a URL?
The real power of the web is the ability to create hypertext links to related information. That other information may be other web pages, graphics, sounds, digital movies, animations, software programs, contents of a file server, a log-in session to a remote computer, a software archive, or an "ftp" site. The World Wide Web uses an addressing scheme known as URLs, or Uniform Resource Locators (sometimes also called "Universal Resource Locator"), to indicate the location of such items. These hypertext links, the ones usually underlined in blue, are known as anchors (This should not be news to you as you followed several to get this far!). In the next lessons we will: Review the concept of URLs. Find and copy URLs from your web browser to your HTML text document. Write an HTML anchor to link to another document in the same directory as our first document. Write an HTML anchor to link to another document in a different directory as our first document. Write an HTML anchor to link to another web document on the Internet. Write an HTML anchor that links to another section of the same document. Incorporate a graphic that acts as a "hyperlink" to another document.

After all, without the hypertext, we would be only calling this "Writing TML" and not Writing HTML

103

8a. Linking to Local Files


Can my document talk to my document? Well, they can at least be linked! After this lesson, you will be able to: Create a link to an HTML document in the same directory/folder as your main document. Create a link to display a graphic image. Create a link to a file in a different directory/folder than your main document. Reorganize the structure of your web.

Now, you will take your first step of "anchoring" by creating a hypertext link to a second web page. These links are called "local" because they reside on the same computer as the working document (they do not have to venture out on the Internet). You will also be shuffling around the parts of your growing web site (do you see how this becomes more than just a "home page"?).

Link to Local Files


The simplest anchor link is one that opens another HTML file in the same directory as the presently displayed web page. The HTML format for doing this is: <a href="filename.html">text that responds to link</a> Think of it as "a" for anchor link and "href" for "hypertext reference". The filename must be another HTML file. Whatever text occurs after the first > and before the closing </a> symbols will be the "hypertext" that appears underlined and "hyper." Now follow these steps to build an anchor link in your HTML document to a local file: 1. Open your HTML document, volc.html, in the text editor. 2. First, under the Volcanic Places in the USA heading, enter the following text which introduces the two volcanoes discussed in later sections. 3. 4. Listed below are two places in the United States that are considered "active" volcanic areas.

104

5.
6.

Below the "Mount St. Helens" heading, enter:

7. On May 18, 1980, after a long period of rest, this quiet 8. mountain in Washington provided <a href="msh.html"> 9. detailed observations</a> on the mechanics of highly explosive eruptions. The text "detailed observations" will link the viewer to a second HTML document called msh.html. This second HTML file does not yet exist; we will construct it in steps (5) and (6). 10. Save and close your HTML document 11. Now, with your text editor, open a window for a New document. 12. Enter the following text in the new window: 13. 14. <html> 15. <head> 16. <title>Mount St Helens</title> 17. </head> 18. <body> 19. <h1>Mount St Helens</h1> 20. The towering pine trees of this once-quiet mountain 21. were toppled over like toothpicks. 22. </body> 23. </html> 24. Save this file as msh.html in the same directory/folder as your working HTML file (volc.html). 25. Reload volc.html in your web browser. 26. Test the hypertext link for the words "detailed observations". When selected, it should connect you to the new page about Mount St. Helens.

Anchor Link to a Graphic


we learned how to display an "inline" graphic that would appear in your web page. With the anchor tag, you can also create a link to display a graphic file. When the anchor link is selected, it will download the image file and display the image by itself in your web browser. NOTE: Most web browsers will display such a link to an image file directly in your web browser. Depending on the web browser, and the preferences/settings on your computer, you may be promoted to either save the file or to select an application to display the file. Regardless of the action, if you get that far, the link to the image file has succeeded.

105

The simplest anchor link is to a file in the same directory/folder as the document that calls it. The format for creating a hypertext link to a graphic is the same as above for linking to another HTML document:

<a href="filename.gif">text that responds to link</a> where filename.gif is the name of a GIF image file. Now follow these steps to add a link to a graphic file in your HTML document: 1. 2. 3. Download a copy of a GIF image from the Lesson 8a Image Studio. Open the msh.html file in the text editor. Modify the text to include a link to the image of Mount St. Helens.

4.

5. The towering pine trees of this once-quiet mountain were <a href="msh.gif">toppled over like toothpicks</a>. 6. 7. 8. Save the msh.html file and Reload in your web browser Now click on the link you just created in step (3). A picture of blown down trees should be displayed.

Links to other directories


The anchor tags can also link to an HTML document or graphic file in another directory/folder in relation to the document that contains the anchor. For example, in our lesson, we may wish to keep all of the graphics in a separate directory/folder called pictures. As you create more and more HTML files, keeping the image files in its own area will make things a bit more organized for you. Let's do that now: 1. From your computer system, create a sub-directory/folder called pictures in the same location where your volc.html file is stored. 2. Move the msh.gif file to this new sub-directory/folder. 3. Open the msh.html file in your text editor. 4. Edit the anchor tag for the graphic to read:
5.

6. The towering pine trees of this once-quiet mountain 7. were <a href="pictures/msh.gif">toppled over like toothpicks</a>.

106

NOTE: With HTML you can direct your web browser to open any document/graphic at a directory level lower (i.e. a sub-directory or folder within the directory/folder that contains the working HTML file) by using the "/" character to indicate the change to a sub-directory called "pictures."

work area volc.html pictures msh.gif

8.

Save the HTML document and Reload in your web browser.

If all went well, the link in the sentence describing the blown-down trees should now call up the graphic file stored in the pictures sub-directory/folder.

Anchor Links to a Higher Level Directory


The types of links we have constructed here are known as "relative" links, meaning a web browser can construct the full URL based upon the current location of the HTML page and the link information in the <a href=...> tags. This is very powerful because you can build all your web pages on one computer, test them, and move them to another computer -- all the relative links will stay intact. In this lesson we saw how to construct a hyperlink to a document that is stored in a directory lower than the working HTML page. Note that you can also construct a link that connects to a higher level directory as well by using this HTML: <a href="../../home.html">return to home</a> Each instance of "../" the URL of an anchor link tells the web browser to go to a higher level directory/folder relative to the current page; in this case to go up two directory/folder levels and look for a file called home.html. In our example, let's say that our pictures sub directory was not in the same directory/folder as the volc.html file but was actually one level higher.

107

In the previous section we constructed a link from the volc.html file to the msh.gif file in a subdirectory: <img src="pictures/msh.gif"> Now, we want to reorganize our web structure so that the pictures folder/directory is at a higher level. The link is now written: <img src="../pictures/msh.gif"> so the web browser looks for a folder called "pictures" that is stored one level up from our volc.html file. An advantage of this structure is that it would be easier to store a large number of graphics in this upper folder/directory that can be shared in other web pages. We may do another lesson on landforms that makes use of the pictures stored in this folder/directory. So now it is time to do a little re-organizing of our HTML files. This requires that you are familiar with moving files and directories around on your computer. Read this carefully! It may be feeling like it's getting complicated, but it will all be clear soon! 1. First, create a new folder/directory and name it volcano (it is recommended to keep the file names in all lower case). 2. Now, move the two HTML files volc.html and msh.html into this new folder/directory. 3. Move the pictures folder/directory (along with the msh.gif file inside) so that it is in the same level as the new volcano folder/directory. Also, move the lava.gif file that we added in lesson 7a into the pictures folder. 4. So your entire workarea directory should now contain two subdirectories -- one that holds your HTML files (volcano) and another one that holds the graphics (pictures):

work area pictures lava.gif msh.gif volcano

108

volc.html msh.html

5. We've moved some things around so now we will have to update the anchor links in our HTML files. First, look at the first local link we built in the volc.html file: 6. 7. <h3>Mount St Helens</h3> 8. On May 18, 1980, after a long period of rest, this quiet 9. mountain in Washington provided <a href="msh.html">detailed 10. observations</a> on the mechanics of highly explosive 11. eruptions. NOTE: Since the msh.html file is still in the same relative directory as volc.html, we do not have to change any of this HTML! Can you see how relative file linking is one of the powerful features of HTML? 12. But now let's look at the link to the picture of Mt. St Helens that we created in the msh.html file: 13. The towering pine trees of this once-quiet mountain 14. were <a href="pictures/msh.gif">toppled over like toothpicks</a>. Open this file in your text editor and edit the link to read: The towering pine trees of this once-quiet mountain were <a href="../pictures/msh.gif">toppled over like toothpicks</a>. This relative link tells the web browser to go up one level from the current folder/directory (volcano) and look there for another folder/directory called pictures that contains a GIF image called msh.gif 15. You will have to update the <img...> tag that displays the title graphic. Open the volc.html file in your text editor and modify the line just below the <body> tag to read: <img alt="A Lesson on:" src="../pictures/lava.gif" width=300 height=259>

109

16. Save your file. You should then Open the volc.html file in your web browser and test the link to msh.html and then try the link to the picture of Mount St Helens.

One More Small Change


This last small step may not be obvious, but we will explain it shortly. The last thing you should do in this lesson is to change the name of your working file from volc.html to index.html. You should do this using the normal way of editing a file's name from the computer desktop (on the Macintosh click on the file name; on Windows right-mouse click on the icon and select the option for Rename). Note also for Windows users that if you use a special editor program to create HTML files, you will not see the ".html" extension on the desktop file name, so in that case, you would change the file name from volc to index because under the hood, the computer knows that there is a ".html" at the end. Why are we doing this? Let's say you have finished this lesson and are ready to store it on a World Wide Web server for the world to see. And let's assume that the Internet address for this server at Big University is:

http://www.bigu.edu/ And your file will be stored in a series of directories: --= top level of server: www.bigu.edu /courses /science /geology /volc.html so that the URL for the Volcano Web might be: http://www.bigu.edu/courses/science/geology/volcano/vol c.html Pretty long, eh? Now here is the promised explanation -- on most WWW servers you can designate one standard name that is the "default" web page for that directory and on most systems that name is.... index.html. What this means is that the Internet address: http://www.bigu.edu/courses/science/geology/volcano/ is equivalent to

110

http://www.bigu.edu/courses/science/geology/volcano/index.htm

This might make you think that it is a lot of energy to cut 20 letters out of a URL! But it does tend to make your URL look a bit more professional -- If you were creating the Longhorn Cheese Home page, http://www.cheese.com/longhorn/ looks less redundant in print than http://www.cheese.com/longhorn/longhorn.html which comes into play when people read about your URL and are trying to connect by typing it into their web browser. Note also that this special file name index.html is used on most web servers but it might also be default.htm-- check with the people that run your web server.

Independent Practice
Create a second HTML document that uses the HTML formatting that you are familiar with at this point. Return to the first one you created and make an anchor that links to this new one.

Review Topics
1. What were the steps you used in creating a link within your document to a local file? 2. What steps did you use to create a link which displayed a graphic in an external window? 3. How did you create a link to a file in a lower directory/folder than your main document? a higher directory? 4. What is the significance of a file called index.html on a WWW server?

111

8b. URLs: Pointers to the Internet


URL? Earl? Yurl? hurl? gyrl? It's getting time to link to that Big Wide Web using the web's addressing scheme. After this lesson you will be able to:

Identify the function of Uniform Resource Locators (URLs). Recognize the structure of a URL. Examine the URLs in the hypertext links of any web page.

Note: For this lesson, you will not need your HTML text file. This is another loweffort lesson!

What is a URL?
The Uniform Resource Locator (URL) is what the WWW uses to find the location of files and documents from computers on the Internet. On your web browser screen, the URL for this document is typically displayed in the upper part of the Web browser window. The URL includes:

an identifier for the type of Internet server; an Internet address; and a file path to the particular item of interest.

The URL is what you will need to build a link from the web page that you are creating to connect to some other piece of information available on the Internet. For more information, see Curling Up To URLs (v0.2)

How are URLs Structured?


The structure of a URL is: type://in.ter.net.address/directory/subdirectory/.../filename The "type" indicates the type of Internet server being accessed: http a web server, "HttP" stands for HyperText Transfer Protocol gopher an Internet Gopher site or menu driven directories of files and information ftp an anonymous File Transfer Protocol (FTP) site, archives of files. 112

telnet initiates a Telnet session to log on remotely to another computer When selected, your web browser will launch a Telnet external program and connect to the specified site. WAIS Wide Area Indexed Server -- a site to search a collection of subject oriented documents by keywords file A file on your local computer system (hard drive, floppy, local file server) The type is always followed by "://" and the Internet address of a remote computer. This is in the structure of: host.domain.domain.domain For example: machine.department.college.edu 123.45.6.78 office.company.com agency.branch.gov machine.organization.country If the URL is to the main level of this host (its "home page"), then the URL is terminated with a slash "/". If you are linking to a sub-directory or a file, you must also add the exact path to that item using the slash character to indicate the entire file path. Note: For most web servers spelling does count! So does capitalization! File names on UNIX computers are case sensitive, meaning that a file named
SpiffyText.html

is a different file than

spiffytext.html

Experimenting With URLs


Note that URLs can link to any site, directory, subdirectory, text file, image, digital movie, or sound file on any Internet site that is set up for public access. The best way to see different URLs is just to move your mouse over any hypertext link in any web page -- if you look at the bottom of your web browser, it should display the URL that you would connect to if you clicked on that link. You could go to a big site such as Yahoo and "peek" at URLs (did you see the URL for Yahoo when you moved your mouse over the link in the this sentence?) Here is an easy way to copy a URL for a link in any page. You first must access the "secret" pop-up menu from any hypertext link in a web page -- click and hold the 113

mouse for Macintosh; click the right mouse button for Windows and Unix. From this menu, select Copy This Link Location (or similar menu item). After releasing the mouse button, jump to any text document and select Paste from the Edit menu. Voil! You've just nabbed a URL from a link in the web page (this way, you can copy a URL without even visiting the page it links to!)

Review Topics
1. 2. 3. 4. What purpose do URLs serve for the World Wide Web? Where are URLs found on a WWW screen? What is the basic structure of an URL? How can you see the URLs that a hypertext link will jump to?

Independent Practice
Find some sites on the Internet that intrigue you. For each one, record its name and its URL displayed near the top of your browser window. See if you can copy and paste the URLs into a text document. You will use this list later to add links from your own web pages to these sites that you found.

8c. Links to the World: Internet Sites


You've been revving your engines, and itching to hit the Information SuperHighway, right? Here, we will extend our use of anchor tags to create links to resources out there on the Internet. After this lesson you will be able to:

Create an anchor to link to an Internet site. Quickly copy the URL for a site and use it in your HTML document.

HTML for Anchors to the Internet


Linking to a site on the Internet combines what we have worked on earlier in the lessons on Links to Local Files by incorporating what we have learned about URLs. The full HTML format for an anchor link to an item on the Internet is: <a href="URL">Text to Activate Link</a> where URL is the full Uniform Resource Locator, in quotes, the address for the Internet site where you want to send the viewer. The string Text to Activate Link is what will show up as hypertext in your web browser (usually but not always) underlined and in blue. When a viewer clicks on this hypertext, the web browser will link them to the Internet site indicated by the URL. Remember that a URL can be a link to another

114

World Wide Web (WWW) server, Gopher server, FTP site, or any text, graphic, sound, video file on these servers. Now, we will add a hypertext link to a site that has information about volcanoes on the planet Mars. Follow these directions to add anchor links on your HTML document: 1. 2.
3.

Open your index.html file in the text editor. Below the heading, Volcanic Places on Mars, enter the following text: <a href="http://solarviews.com/eng/mars.htm">
Mars</a> has its fair share of volcanic landforms,

4.
5.

6.including the largest known volcano in the solar system,<a


href="http://www.solarviews.com/browse/mgs/mgsmons1.jpg"> 7. Olympus Mons</a>

Note: We've made a link to two different types of information. The first hyperlink connects to a web page that describes information about the planet Mars. The second is a link to a large JPEG image of a Martian volcano. 8. Save and Reload in your web browser.

Note: We have shown you how to link directly to an image from another web server. You could quite easily use an off-site URL in your IMG tags for your own web pages. We strongly urge you to contact the site's creator and ask permission. In some cases, web site owners are penalized or charged for excessive accesses. For more information on this issue, see a Plea from the Widows Web (Note, as of April 2002, this web site has vanished, but you can find it's remnants from the Internet Archive's WayBack Machine).

A Quick 'n Easy Way to Enter URLs in Anchor Tags


As you navigate among different web pages, the URL of the currently visible page can be viewed at the top of the web browser window (You may have to look for a menu option to Display URLs). For example, in this document, the URL looks something like:
http://www.mcli.dist.maricopa.edu/tut/tut8c.html

You can use your mouse to select and copy a URL from the web browser display and then paste it in the anchor tag of your HTML document. This is much more efficient than writing URLs down on paper (some are quite long!).

115

Now we will add some links to other sites that we will list under the References section of our Volcano lesson. One such site that might offer relevant information is the US Geological Survey. Follow these steps: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Open your HTML document index.html in the text editor Under the heading "References", enter: Use these references to start your research: <ul> <li> <a href="">Educational Resources from the USGS</a> </ul> NOTE: We've constructed the hypertext link but we still need to enter a URL between the quotes. 11. Connect to the US Geological Survey Education Index. 12. From the web page, use the mouse to Select the URL as displayed in the URL display field. 13. From the Edit menu, Copy the URL. 14. Now, return to your HTML document index.html 15. Click the mouse once between the two quote marks you inserted in step #2 and Paste the text you copied in step #5. The final anchor tag should look like: 16. 17. <ahref="http://info.er.usgs.gov/education/index.htm
l">

18.

Educational Resources from the USGS</a> Note: You have just set up the HTML structure for an Unordered

For additional practice, explore some of the following Internet sites with resources on Geology and/or Volcanoes. Copy the URLs and construct the hypertext links to at least two more sites in your References section:

Review Topics
1. What is the address for an item on the Internet? 2. What steps did you take for creating an anchor link to the NASA Internet Site? 3. What shortcut was identified for putting an URL into an anchor link? 4. Tell a colleague or friend about any other links that you put in your document. 116

Independent Practice
Create anchor links from your own web page that connect to some of the URLs addresses you have discovered.

8d. Links to Sections of a Page


You have seen how to link to other web pages, whether they are ones you created or have found elsewhere on the Internet. What if you wanted to connect to a specific section within a document? YOU CAN! After this lesson you will be able to:

Create a hidden reference marker for a particular section within an HTML

file. Build a hypertext link that will connect to a particular section within an HTML file. Build a hypertext link that will connect to a particular section within another HTML file. Create a hypertext table of contents for a web page.

The Named Anchor


A named anchor is a hidden reference marker for a particular section of your HTML file. This might be used to link to a different section of the same page if it is long, or to a marked section of another page. For example, on this page you are viewing, I could create a hidden marker called "check" that marked the heading below "Check Your Work". Then, I write an anchor link that connects to this section of this document. Once you click on a link to this named anchor, your web browser will jump so this line is at the top of the screen. The HTML format for creating the named anchor is: <a name="NAME">Text to Link To</a> or for the link you just tried above: <a name="check">Check Your Work</a> Notice how this subtly differs from the anchor link <a href=... that we learned about.

Writing a Link to a Named Anchor

117

When you want to create a hypertext link (or an "anchor link", see lesson 8a) to a named anchor, use the following HTML: <a href="#xxxxx">Text to act as hypertext</a> or for the link you just tried that sent you to the section below:

Go to

<a href="#check">Check Your Work</a>

The "#" symbol instructs your web browser to look through the HTML document for a named anchor called "xxxxxx" or in our example "check". When you select or click on the hypertext, it brings the part of the document that contains the named anchor to the top of the screen.

Adding Named Anchors to the Volcano Web Lesson


Now, we will build a table of contents for our lesson that will appear at the top of our Volcano Web page. The entries for this will be the headings we have already created. Each will act as a hypertext link to a particular section of our lesson. The first step is to create a named anchor for each of the heading sections in your Volcano Web lesson: 1. 2. Open your index.html file in the text editor Find the heading for the Introduction. Change it from:

<h2>Introduction</h2> so that it looks like: <h2><a name="intro">Introduction</a></h2> NOTE: You have just marked the line that contains the header "Introduction" with a hidden reference marker, the named anchor "intro". 3. In a similar manner, change all header <h2> tags for the other sections: 4. 5. <h2><A NAME="term">Volcano Terminology</a></h2> 6. 7. <h2><A NAME="usa">Volcanic Places in the USA</a></h2> 118

8. 9. <h2><A NAME="mars">Volcanic Places on Mars</a></h2> 10. 11. <h2><A NAME="project">Research Project</a></h2> 12. If you Reload now from your web browser, you will not notice any visible change. The named anchor tags we have just added are hidden from the user's view.

Adding Links to a Named Anchor in the Same Document


Now we will set up a table of contents that will appear at the top of the screen. We will use an unordered list to create this list: 1. If not already open, open your index.html file in the text editor. 2. Below the first sentence under the Volcano Web heading enter the following text: 3. 4. <hr> 5. <b>In this Lesson...</b> 6. <ul><i> 7. <li>Introduction 8. <li>Volcano Terminology 9. <li>Volcanic Places in the USA 10. <li>Volcanic Places on Mars 11. <li>Research Project</i> 12. </ul> NOTE: This index is marked off above and below by a solid line using the <hr> tag. The Italic style is used on the entries for the text. At this point we have only entered the text of the index entries. Below we will add the HTML to make the links active. 13. Save and Reload into in your web browser.

Finally, we want to make each item of the list act as a hypertext link to another section of the document. To do this, we will use a variation of the basic anchor link. Rather then linking to another file, we link to one of the named anchors (the hidden markers that you created above) within the same HTML file. We indicate a named anchor by preceding the reference marker name with a "#" symbol:

119

1. 2. 3. 4.

Open your index.html file in the text editor Go to the first list item in your index section. Change it from: <li>Introduction

to look like:
<li><a href="#intro">Introduction</a> 5. You should now be able to fill in the other links to named anchors so that the section looks like: 6. 7. <hr> 8. <b>In this Lesson...</b> 9. <ul><i> 10. <li><a href="#intro">Introduction</a> 11. <li><a href="#term">Volcano Terminology</a> 12. <li><a href="#usa">Volcanic Places in the USA</a> 13. <li><a href="#mars">Volcanic Places on Mars</a> 14. <li><a href="#project">Research Project</a></i> 15. </ul> 16. Save and Reload into your web browser. When you click on an item in your index, the browser should display the associated section at the top of your screen. NOTE:Your web browser will try its best to bring to the top of the browser the text enclosed by the <a name="xxx">...</a> occurs. In this case, there is no content after the last few examples, so when you click on the link to Research Project it will not jump to the very top of the screen. If you really wish to make this happen, until we write more content under this heading in youre document, you can insert 10-20 of <br> tags.

Adding Links to a Named Anchor in Another Document


You can create a link that jumps to a section of another HTML document that is marked by a named anchor. The HTML for building a link to a named anchor in another local HTML document is: <a href="file.html#NAME">Text to activate link</a> and if the document exists on another web site:

120

<a href="http://www.cheese.org/pub/recipe.html#colby">Colby

Cheese</a> In lesson 8a we created a hypertext link that jumped from the section of our lesson on Mount St. Helens to msh.html, a separate HTML file. Now we will add a link in that second document that will return to the original section of the main Volcano page.

1. Open your msh.html file in the text editor 2. Near the bottom of the HTML (but above the </body> tag) enter the following text: 3. 4. <hr> 5. <a href="index.html#usa">Return to <i>Volcano Web</i></a> NOTE: We have included the Italic Style tag <i>...</i> within the text marked by the named anchor "usa". 6. Save and Reload into your web browser. When you click on one of the hypertext links at the bottom of the msh.html page, you should jump back to the "Volcanic Places in the USA" section of the Volcano Web lesson. In this case the link is just the name of another HTML file, msh.html, in the same directory as the index.html file. However, you can use a full URL to link to a named anchor in an HTML file on a remote computer. For example, to create a link to the "Introduction" section of an HTML file stored on the MCLI WWW server, the syntax would be: <ahref="http://www.mcli.dist.maricopa.edu/tut/final/inde x.html#intro">Introduction to Volcano Web</a> The reference marker "#anchor_name" is tacked onto the end of the URL.

Review Topics
1. How do you identify a named anchor? 2. What are the steps for creating a link to a different section within a document? 3. How do you modify an anchor link to connect to a named anchor in another HTML document? 4. How do you create a table of contents for a web page?

121

5.

What is the difference in function between the tags <a href="...> and <a name="...> ?

Independent Practice
Create named anchors for the headings in your own web page and build an index that will link to these sub-sections.

8e. HyperGraphics
Text does not have a monopoly on being "hyper"... expand the versatility of your web pages by having pictures act as hyperlinks (Just try clicking the cube!). After this lesson you will be able to: Insert a graphic button in your web page that links to another HTML document. Insert a small graphic that acts as a "postage stamp" button for a link to display a larger copy of the image.

A HyperLink Button
From the previous lessons, you have (hopefully) become comfortable with creating hypertext, text within your documents that connects a viewer to related information. You can also use inline images to act in a "hyper" manner. If you recall, in an earlier lesson we linked some text in our Volcano Web page, index.html, to a second page, msh.html, that described Mount St. Helens. Now in the latter page, we want to add a button that when clicked will link a reader back to the main lesson page.

122

The way to do this is to put the HTML tags for inline images within the hypertext portion of the anchor tag: <a href="fileX.html"> <img src="graphic.gif"> Go to Document X</a> In your web page, this HTML code will display an inline image and the text Go to Document X. Both will act as hyperlinks; clicking on either the text or the picture will tell your web browser to go to the HTML file fileX.html. The image alone could be a hyperlink. In the World Wide Web, a "HyperGraphic" generally is surrounded by a colored box matching the color of hypertext on your web page, so you know that it is "active". NOTE: Many browsers now can alter the color of hypertext and some pages have suppressed the display of the outline around HyperGraphic links. Generally, you can identify a hyperlink area on a web page by looking for a change in the cursor as it passes over a "hot" region. The cursor usually changes from an arrow to a hand when it passes over an active link. From a design standpoint, we recommend that if you use pictures to act as hyperlinks that you offer also a text link or use the ALT= attribute in the <IMG...> tag in case the viewer has turned off the loading of images. You should now have a copy of the image file somewhere on your computer (You should move it to the pictures folder/directory in your workarea). Next, add the HTML to make the button work: 1. Open the second HTML file, msh.html in your text editor. 2. At the bottom, modify the last line to: 3. 4. <hr> 5. <a href="index.html#usa"> <img src="../pictures/left.gif"> 6. Return to <i>Volcano Web</i></a> Note: The inlineimage tag (<img...>) is completely within the anchor between the > that marks the end of the URL and the </a> that marks the end of the hypertext. Also note how the <i> tag is used within the active hypertext to emphasize the title of the lesson. And finally, we have used the <hr> tag to put a horizontal rule or a line above the button graphic. 7. Save the HTML file. 8. Return to your web browser, and select Open Local from the File menu to read in the msh.html file. 9. Select Reload from the File menu to update the changes.

123

10. Test the hyperlink to the Mount St. Helens page and the new button that should return you to the Volcano Web page.

"Postage Stamp" Images


Previously, we advised against using large inline images in your web pages because viewers might have to wait a long time for images to download to their computer. One way around this is to create miniature-size copies of the graphic, or "postage stamps" which are displayed as inline graphics. Then, using the same steps as above, you can make the "postage stamp" image act as a hyperlink that links to the full size image. In this way, the large images are downloaded only if the viewer decides to see it. First, you need to get a copy of the two image files from the (These files should be stored in your pictures folder/directory of your workarea). Next, create the postage stamp link in your main text file: 1. Open the index.html file in your text editor. 2. Under the heading Long Valley enter the following: 3. 4. This field seismometer measures earthquakes associated 5. with subsurface volcanic forces and may help to predict 6. future events. It sits on a plateau known as the "Volcanic 7. Tableland" formed by a major eruption 600,000 years ago. 8. <p> 9. <a href="../pictures/seismo.jpg"> 10. <img src="../pictures/stamp.gif" ALT="link to large image" 11. WIDTH="62" HEIGHT="85"> 12. -- [full size image, 55k] -13. </a> The inline image, stamp.gif acts as a hyperlink to a larger image, seismo.jpg. When a user clicks on either the "postage stamp" or the text "-- [full size image, 55k] --", your web browser will display the larger image in a browser page. Note the use of the dimensions of the stamp.gif image in the <img...> tag as well as the ALT=... attribute. In our hypertext link we provide information that this image is 55k in size. By doing this, you provide the viewer the choice if they want to download

124

14.

an image of that size... If the link leads to something that is 1.6 Mb, as a viewer you might want to know that before you tried to view such a large file size. Save and Reload in your web browser.

Review
Review topics for this lesson: 1. How did you create the graphic button in your web page? 2. How are "postage stamp" links useful in including graphics in your web page? 3. How did you create your "postage stamp" link in your document?

Independent Practice
Try to add buttons that link two web pages to each other. In a later lesson we will learn how to avoide the "box" around a hypergraphic.

9. Preformatted Text
How do you display text where return

space, characters

TABS count?

and

carriage

After this lesson you will be able to: Create a table of aligned text Control the placement of text on a page when tabs and spaces are important.

In previous lessons we have seen that a web browser will ignore extraneous space characters, tabs, and carriage returns in your HTML files. However, there are some instances where it will be important to maintain these aspects of page layout. In this lesson, the example will be where we want to insert a table of text with aligned columns. The preformat tag instructs your web browser to display the text exactly as typed in the HTML document, including spaces, tabs, and carriage returns. A browser typically displays such text as a

125

m o n o s p a c e d type, meaning a font in which every character has the same width. Here is example of what the preformat does:

<pre> We have indented with 5 space characters. And used the carriage return to jump to a new line. Here use spaces create text </pre> Without the <pre> and </pre> tags, the same HTML produce: we to a table.

We have indented with 5 space characters. And used the carriage return to jump to a new line. Here we use spaces to create a text table. With the preformat tag, it helps if the text editor you are using can display in a monospaced font (such as "Courier" or "Monaco"); if not, you will have to count spaces when aligning text into columns (and you will mutter bad words under your breath). For our Volcano lesson, we want to add a table under the Introduction section that lists several well-known volcanoes, when they erupted, and the volume of erupted material. To do this: 1. Open the second HTML file, index.html in your text editor. 2. Under the last portion of the Introduction section, place a header of level 4 (<h4>) with the text Volumes of Some Well-Known Volcanic Eruptions (If you do not remember how to make headers). 3. Below this heading, enter the following text exactly as follows (this would by an opportune time to cut and paste from this web page!):
4.

5.

<pre>

126

6. Eruption Date Volume in km^3 7. -----------------------8. Paricutin, Mexico 1943 1.3 9. Mt. Vesuvius, Italy 79 A.D. 3 10. Mount St. Helen, Washington 1980 4 11. Krakatoa, Indonesia 1883 18 12. Long Valley, California pre-historic 500 - 600 13. Yellowstone, Wyoming pre-historic 2400 14. </pre>

In this example we use space characters to make the first column left justified and the other 2 columns center-justified. The dashes are used to highlight the column headings. 15. Save and Reload in your web browser.

Review
Review topics for this lesson: 1. How does the preformat tag change the way that a web browser interprets HTML? 2. In what other situations might you use this tag?

More Information
You can still use HTML tags inside text that is marked by the preformat tag. For example we can add a hypertext link and some style tags that are within the <pre>...</pre> tags: HTML <pre> This tutorial is copyright 1995, 1996 <b>Be sure to tell all of your friends about it!</b> <i>We Welcome Your 127 Result This tutorial is copyright 1995, 1996 Be sure to tell all of your

Feedback</i> fondly, <a href= "http://www.mcli.dist.maricopa.edu/"> mcli</a> </pre>

friends about it! We Welcome Your Feedback fondly, mcli

Note that the HTML tags do not count as spaces; they are ignored within the preformat region. Some web page developers will use the <pre>...</pre> tags with carriage returns in between to add white space between text or graphics in their web pages -- especially if they wish more white space than provided by the <p> tag. For example: HTML Result Cheese was long since abolished from the Orient. Cheese was long since <pre> abolished from the Orient.

</pre> ...until Sir Longhorn arrived with the great Cheese Crusade of 1167.

...until Sir Longhorn arrived with the great Cheese Crusade of 1167.

Independent Practice
Add a table or chart to your HTML document using the preformat tag.

10. Special Characters


How do you say...

>>> ?
NOTE: If the above characters do not display various accents or diacritical markers, then your web browser does not support the ISO character set. You would likely want to skip this lesson.

128

After this lesson you will be able to: Use the HTML codes for ISO Latin 1 characters to display accent marks for non-English letters. Override the HTML use of < and > symbols when you need them in a document. Add extra spaces in between words and letters in a document.

Accent Marks
Sometime you may need to use a special character in an HTML document, an accent or diacritical mark. The ones that are known as ISO These special characters are marked in HTML as: &xxxx; where XXXX is the code name for the special character. To create the special character for the German umlaut (), we need to use the HTML: &uuml; For example, in the Terminology section of our Volcano lesson, we want to add an explanation of a technical term that was used to describe a particular type of volcanic flow. This term nuee ardente is from the French term for "glowing cloud"; but to use the proper spelling we need an "acute" accent, so that the word appears as nue ardente. In this case, we replace the first e in nuee with the HTML for the acute accented "e" &eacute;: nu&eacute;e ardente For reference on these codes, see the list of special ISO characters. Now we will add a sentence to our HTML document that uses an accented letter: 1. 2. text:
3.

Open the HTML file, index.html in your text editor. Under the list of terms of the Volcanology Terminology section enter the The term <I>nu&eacute;e ardente,</I> or "glowing cloud" was first used by La Croix

4. 5. (1904)

129

6. in his description of the volcanic flows he observed in 7. the 1902 eruption of Mt Pel&eacute;e, a historically 8. active volcano on the island of Martinique. NOTE: We have applied the acute accent mark for two "e" letters in this sentence. It may look strange! Be sure that you replace the letter with the sequence that displays the same letter with the accent mark. 9. Save and Reload the HTML file.

HTML Escape Sequences


The HTML for the accent mark is an example of the more general class of tags known as escape sequences. In entering HTML so far, you may have wondered what you do when you need to use a < (less-than) or a > (greater-than) sign? These two characters, plus the & (ampersand) have special meaning in HTML and cannot be used as typed. Instead, use the escape sequences: &lt; is used for < &gt; is used for > &amp; is used for & Now let's apply one of these symbols in our Volcano lesson. In the previous, we added a table that lists several volcanoes and how much material was erupted from each. Let's say one of the values (500-600) for Long Valley is not very accurate (often such values are estimates), and we would like the entry to read >450 & <700. To do this: 1. Open the HTML file, index.html in your text editor. 2. Under the heading of Volumes of Some Well-Known Volcanic Eruptions, find the line for Long Valley in our table:
3.

4.

Long Valley, California pre-historic 500 - 600

and change it to: Long Valley, California &gt;450 &amp; &lt;700 pre-historic

NOTE: Although we are using the escape sequences within a preformatted text, note how a web browser properly interprets and displays the special characters. The escape sequences can thus be used in all portions of an HTML document including headings and anchor links.

130

5.

Save and Reload the HTML file.

Extra Spaces
As you may have seen, a web browser will ignore all extraneous spaces in your HTML files. However, there may be times when you really want to have more than one space. When? Some writers like to have two spaces following the period at the end of the sentence. What if you wanted to indent the first sentence of every paragraph? How about having a single word with its individual letters spaced far apart? An HTML code for adding a space character is the special character known as the "nonbreaking space": &nbsp; Here are some examples of how you might use the non-breaking space: HTML Result Two non-breaking spaces are used to spread the letters in a word farther apart <b><tt> C &nbsp; H &nbsp; E C H E E S E &nbsp; E &nbsp; S &nbsp; E </tt></b> HTML Result Two non-breaking spaces are used to indent the first sentence of each paragraph &nbsp; &nbsp; When Sir Longhorn When Sir Longhorn had tragically died, no one was had tragically died, left to carry on his tradition. There was much sadness in no one was left to the land. And no cheese. carry on his tradition. But then the young genius Sheila Colby discovered There was much the missing ingredient. And once again, cheese was sadness plentiful. in the land. And no cheese. <p> &nbsp; &nbsp; But then the young genius Sheila Colby discovered the missing ingredient. And once again, cheese

131

was plentiful. HTML Result One extra space is used to add an extra space after the end of each sentence. &nbsp; &nbsp; When Sir Longhorn When Sir Longhorn had tragically died, no one was had tragically died, left to carry on his tradition. There was much sadness no one was left to in the land. And no cheese. carry on his tradition. &nbsp; But then the young genius Sheila Colby discovered There was much the missing ingredient. And once again, cheese was sadness in plentiful. the land. &nbsp; And no cheese. <p> &nbsp; &nbsp; But then the young genius Sheila Colby discovered the missing ingredient. &nbsp; And once again, cheese was plentiful. You may want to experiment with different ways to use the non-breaking space. At this time, we will not modify our HTML documents, but you may, if you wish, add the code for indenting each opening sentence of all paragraphs using two instances of the special code for the non-breaking space.

More Information
Here are some more special characters that you may find useful: Name Copyright Trademark Cent Degree sign double-less than micron Midline dot Negation, continuation line Paragraph HTML &copy; &reg; &cent; &deg; &laquo; &micro; &middot; &not; &para; Result

132

Plus/Minus British Pound double greater than Section Yen

&plusmn; &pound; &raquo; &sect; &yen;

Review
Review topics for this lesson: 1. 2. 3. 4. In HTML, what is the correct way to display a German umlaut ()? What happens if you do not use an escape sequence for < and >? Why would you need a special escape sequence for the & character? How can you indent paragraphs?

Independent Practice
In your own HTML document, add a foreign word that requires a special accent or a mathematical expression that uses the < or > symbol. Or, add some extra spaces to indent your paragraphs.

11. Definition Lists


Yet another variety of

lists
o

lists

lists...

After this lesson you will be able to:


build a list of items with indented text block definitions create a bibliography with a definition list

We saw how to create two types of lists: ordered <ol>...</ol> and unordered <ul>...</ul> lists. We now introduce a third variety, the definition list. Unlike the lists we have seen earlier, the definition list marks its entries not with a bullet marker or a number, but by its pattern of indentation. The format for a definition list tag is:

133

<dl> <dt> <dd> <dt> <dd>

title1 definition1 title2 definition2


: : :

<dt> titleN <dd> definitionN </dl> The <dl> .... </dl>; tags include alternating pairs of titles <dt> and definitions <dd>. A Web browser will typically generate the list with each definition indented to offset it from the title. Viewed in a web browser, the above example looks like this:

134

title1 definition1 title2 definition2 : : titleN definitionN The definition list might be used as a glossary , but for our example we will use it to create a short bibliography for our Volcano Web lesson: 1. 2. Open the HTML file, index.html in your text editor. After the unordered list under the heading References enter the following:

3.

4. <h3>Bibliography</h3> 5. Check your library for these books: 6. <dl> 7. <dt>Cas, R.A.F. and Wright, J. V. (1987). 8. <dd><I>Volcanic Successions: Modern and Ancient.</I> 9. London: Allen &amp; Unwin. 10. 11. <dt>La Croix, A. (1904) 12. <dd><I>La Montagna Pel&eacute;e et ses &Eacute;ruptions.</I> 13. Paris: Masson 14. 15. <dt>Lipman, P.W. and Mullineaux (eds). (1981) 16. <dd><I>The 1980 Eruptions of Mount St. Helens, Washington.</I> 17. U.S. Geological Survey Professional Paper 1250. 18. </dl> NOTE: We have used some of the Special Characters for the ampersand symbol ("&") in the first reference and for the accent marks in the second reference. If you are unfamiliar with the HTML special characters. 19. Save and Reload into your web browser.

Review

135

Review topics for this lesson: 1. 2. 3. How does the definition list differ from the ordered and unordered lists? In what instances might you use a definition list? What is the difference between the <dt> and the <dd> tags?

Independent Practice
Use a definition list to add a glossary or bibliography to your own HTML page.

More Information
You can include other ordered/unordered lists within a definition list. For example, let's say we are making a list of the major mineral groups, with a description of their characteristics, and a sublist of minerals in each group and how they are used in society. We wish it to look like (just a few entries are shown): Oxides Combinations of metal ions with Oxygen, comprises the major ores extracted in mining operations

Hematite (iron ore) Magnetite (iron ore, magnetic mineral) Corundum (gemstone, abrasive)

Sulfates Metal ions combine with the Sulfate ion (SO4), atomic structure sometimes can allow bonding of water molecules

Gypsum (plaster) Barite (drilling mud)

The HTML to produce this is: <dl> <dt><b>Oxides</b> <dd>Combinations of metal ions with Oxygen, comprises the major ores extracted in mining operations <ul> <li>Hematite (iron ore) <li>Magnetite (iron ore, magnetic mineral) <li>Corundum (gemstone, abrasive) </ul> <dt><b>Sulfates</b> 136

<dd>Metal ions combines with the Sulfate ion (SO4), atomic structure sometimes can allow bonding of water molecules <ul> <li>Gypsum (plaster) <li>Barite (drilling mud) </ul> </dl>

12. Address Footers and E-Mail Links


Hey! You created a snazzy web page -- autograph it with a footer! Let people on the web send you an e-mail message right from your web page! After this lesson you will be able to:

insert a stylized footer at the bottom of a page create a hypertext link that will send an e-mail message

A worthwhile feature of web pages is a "footer" at the bottom of a page that provides information about the author and the document, maybe the last date it was modified, as well as a means to send the author a message by e-mail. This is the place for the address tag which just stylizes a block of text in italic and offsets it to a new line. It is a good idea to make footers brief, informative, and consistent between your different web pages. Some useful information to include is:

Title or subject of the current page Date it was created/updated Copyright if appropriate (or even meaningful?) Name and e-mail for the web page author Name and hypertext link to affiliation/organization

As examples, see the footers at the bottom of every web page in this tutorial. In composing your own style, take a look at other web pages for ideas. Imitation still is a very high form of flattery! The HTML format for the address tag looks like: <address> text text text text text text text text text text text text text text text text text text </address>

137

Note that all other HTML inside the address tag is legal, so we might modify it with bold tags, line breaks, and a hypertext link tag:

HTML <address> <b>Page Title</b><br> Last Updated February 31, 1999<br> Web Page by Alan Levine (webdude@jade.mcli.dist.maricopa.edu) <br> <a href="http://www.mcli.dist.maricopa.edu/"> Maricopa Community Colleges</a><br> </address>

Result Page Title Last Updated February 31, 1999 Web Page by Alan Levine (webdude@jade.mcli.dist.maricopa.edu) Maricopa Community Colleges

Now, suppose someone was reading your page and wanted to send you a comment on how nice your page looked. They would have to write down your e-mail address, launch another program, and send you a message. Wouldn't it be great if you could send email from your Web browser? Well, most web browsers now can! The way to do this is to create a hypertext link with the mailto type in the URL Create an email hypertext link like this: <ahref="mailto:webdude@jade.mcli.dist.maricopa.edu">sen d an e-mail to alan</a> When the text send an e-mail to alan is clicked, the web browser will bring up a screen where you can compose a message and send it to me. What's more, you can also insert a default subject line for the e-mail message (NOTE: this may not work on all browsers): <ahref="mailto:webdude@jade.mcli.dist.maricopa.edu? subject=hi from lesson 12"> send an e-mail to alan</a> And there is more you can do by adding on to the mailto link. If you wanted to send the same message to more than one address, say the President and Vice-President, you just put the email addresses separated by commas (note that in your HTML code this should be one long line, we have broken it up so it displays better here):
<ahref="mailto:webdude@jade.mcli.dist.maricopa.edu,pres@ whitehouse.gov, vice-pres@whitehouse.gov?subject=hi from lesson 12">

138

send an e-mail to alan, the pres, and the vicepres</a> Let's say the Vice-President should only be carbon copied ("cc:") on this message. To do this, just add another string after the subject using cc= and the email address. Note that the Subject= string and the cc= string are separated by a &: <a href="mailto:webdude@jade.mcli.dist.maricopa.edu,pres@white house.gov, ?subject=hi from lesson 12&cc=vicepres@whitehouse.gov"> send an e-mail to alan, the pres; cc: the vicepres</a> And lastly, you can try to insert a default message using the syntax body= and the text that should be placed in the body part of the email message window: <ahref="mailto:webdude@jade.mcli.dist.maricopa.edu,pres@ whitehouse.gov, ?subject=hi from lesson 12&cc=vicepres@whitehouse.gov &body=Hi there, I think Alan deserves a dinner at your place."> send an e-mail to alan, the pres; cc: the vicepres, with a default message</a> Please do not try sending these messages! Alan likes e-mail but don't bother the folks in the Whitehouse! Now, let's return to our Volcano example. Note that you can have any text (or graphic) act as the hypertext link. So in the previous example, we would modify the HTML to have the internet address create the link for e-mail. HTML <address> <b>Page Title</b><br> Last Updated February 31, 1999<br> Web Page by Alan Levine <a href="mailto:webdude@jade.mcli.dis t.maricopa.edu"> (webdude@jade.mcli.dist.maricopa.e du)</a> <br> <a href="http://www.mcli.dist.maricop Result Page Title Last Updated February 31, 1999 Web Page by Alan Levine (webdude@jade.mcli.dist.maricopa.e du) Maricopa Community Colleges

139

a.edu/"> Maricopa Community Colleges</a><br> </address> And finally, we recommend that you also put in the footer the URL for the page. Why? What if someone prints out your web page but does not bookmark it or write down its URL? Including the URL on the page provides a handy reference. Just modify the above example (note how this HTML is below the <address>...</address> tag: HTML Result <address> <b>Page Title</b><br> Last Updated February 31, 1999<br> Page Title Last Updated February 31, 1999 Web Page by Alan Levine Web Page by Alan Levine <a href="mailto:webdude@jade.mcli.dis (webdude@jade.mcli.dist.maricopa.e du) t.maricopa.edu"> (webdude@jade.mcli.dist.maricopa.e Maricopa Community Colleges du)</a> <br> URL: <a href="http://www.mcli.dist.maricop http://www.mcli.dist.mari copa.edu/tut/ a.edu/"> Maricopa Community Colleges</a><br> </address> <p> <tt> URL: http://www.mcli.dist.maricopa.edu/ tut/ </tt> Now it is time to add a footer to your HTML file. For this example, we assume you are "Lorrie Lava" a staff Volcanologist at Big University (feel free to put your own information in place of what is below): 1. Open the HTML file, index.html in your text editor. 2. At the bottom of the document (but above the </body></html> tags), add the following: 3. 4. <hr> 5. <address><b>Volcano Web</b> <br> 6. created by Lorrie Lava, <a href="mailto:lava@pele.bigu.edu">lava@pele.bigu.edu</a ><br> 7. Volcanic Studies, <a href="http://www.bigu.edu/">Big University</a><p> 140

8. <tt>last modified: April 1, 1995</tt> 9. </address> 10. <p> 11. <tt>URL: http://www.bigu.edu/web/index.html</tt> NOTE: We've used several HTML tags that have been covered in previous lessons. Also note the extra <p> tag at the bottom; this makes sure the last line of text is always visible. 12. Save and Reload the HTML file.

Review
Review topics for this lesson: 1. What does an address tag do? 2. Does an address tag have to be at the bottom? 3. How do you create a tag that will e-mail to you? to someone else? With a subject line?

Independent Practice
Add an address footer and e-mail links to your own HTML documents.

13. You Can Blockquote Me on That!


Yet another simple HTML tag for re-arranging your text: "What is going on here?" asked the <blockquote> tag to the <p> and <br> tags. They replied, "We are not sure, but you are very different from us!" After this lesson you will be able to:

Insert a block of text that is indented from the body text Apply style tags within blockquote text

In traditional writing, quotations of three or more sentences are set off from the main text as an indented block of text. HTML also includes this capability via the <blockquote>....</blockquote> tag: <blockquote> "This is a long quotation from a very famous person. Since it is so long 141

and interesting, it should really be set off from the rest of the text. This indicates clearly that the quote is from someone other than the writer." </blockquote> which yields:

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "This is a long quotation from a very famous person. Since it is so long and interesting, it should really be set off from the rest of the text. This indicates clearly that the quote is from someone other than the writer." blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah Note that we can apply any and all HTML we have learned so far inside of the <blockquote> tags, such as this example: <blockquote> <H2>A Manifesto</H2> This is a <b>long</b> quotation from a <a href="http://www.mcli.dist.maricopa.edu/alan/"> very famous person</a>. Since it is so long and interesting, it should really be <pre> set off</pre> from the rest of the text. <p> <I>This indicates</I>: <ul> <li>clearly that <li>the quote is from <li>someone other than the writer. </ul> </blockquote> which yields the following:

142

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

A Manifesto
This is a long quotation from a very famous person. Since it is so long and interesting, it should really be
set off

from the rest of the text. This indicates:


clearly that the quote is from someone other than the writer.

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah Let's add a blockquote to the introduction of our Volcano web page. We will use blockquote from the Roman naturalist, Pliny, who witnessed the eruption of the volcano Vesuvius in 79 A.D. 1. 2.
3.

Open the HTML file, index.html in your text editor. Under the <h1>Volcano Web</h1> heading, add the following:

4. <BLOCKQUOTE> 5. <b><I> 6. "Nature raves savagely, threatening the lands" 7. </I></b><br> 8. -- <a href="http://www.livius.org/pipm/pliny/pliny_e.html"> 9. Pliny the Elder</a>, who died of asphyxiation after 10. observing the destruction of Pompeii by the 11. 79 A.D. eruption of Mount Vesuvius. 12. </bLOCKQUOTE>

143

13.

Save and Reload the HTML file.

Review
Review topics for this lesson: 1. 2. What does the <blockquote> tag do? Why don't you need a <p> tag before a blockquote?

Independent Practice
Experiment with the <blockquote> tag in your own web page. Do not just think in terms of using it only for quotations. The tag can be effective for adding some variety to your web page layout. The <blockquote> tag is one way to avoid having many pages full worth of plain text paragraphs. Some developers will use two or three (or more) nested <blockquote> tags to create an effect of wider margins. For example, <BLOCKQUOTE> <BLOCKQUOTE> <BLOCKQUOTE>"Oh, for more tags," he lamented. <p>Replied she, "Remember, dear, that while HTML may be limited in terms of control over page layout, there is a great deal of potential in the creative use of the number of tags." </bLOCKQUOTE> </bLOCKQUOTE> </bLOCKQUOTE> produces:

"Oh, for more tags," he lamented. Replied she, "Remember, dear, that while HTML may be limited in terms of control over page layout, there is a great deal of potential in the creative use of the number of tags." If had just used one set of <BLOCKQUOTE> ... </bLOCKQUOTE> tags, we would have seen:

144

"Oh, for more tags," he lamented. Replied she, "Remember, dear, that while HTML may be limited in terms of control over page layout, there is a great deal of potential in the creative use of the number of tags." You cannot predict the exact amount of spacing this will provide on the sides of the pages, but it is an easy and effective variation for presenting text.

145

14. Lumping vs. Splitting


You made a single web page! But, NOW, it is time to transform your ordinary long-scrolling "page" into a logically connected "web" of information. After this lesson you will be able to:

Transform a single web page to a series of linked pages Create a template for multiple web pages Build navigational features for connecting multiple web pages

Are you a lumper or a splitter? Neither? Both? For organizing information, sometimes it's better to "lump" things together; other times it is better to "split" them apart. Scrolling through long web pages is often tedious. Long, single web pages take longer to load over networks when compare to a series of smaller pages. In many cases, you can identify logical points to "split" information into multiple web-pages. However, there is no magical formula, and opinions will vary. You should strike a balance between pages with breaks that parallel the content yet avoid forcing the reader to click through too many screens of options and sub-options before getting to the desired information. It also becomes important to build in hypertext links that help the reader navigate your information web as well as providing visual clues about their location within the web. So far we have built one web page with a link to a shorter page. We created a list of links that works as a table of contents by connecting them to named anchors for the different sections of the Volcano Web lesson. These same divisions might be sensible breakpoints for splitting the single long page into sub-pages. Up to now we have created a directory called volc that contains our two HTML files (index.html, the lesson, and msh.html, a second web page). We also have a second directory called pictures that contains our graphic image files. We will now split the single Volcano Web file into a series of web pages, linked as shown in this schematic diagram. The entry point is a main index/cover page, index.html that has links that point to each of the other parts of our lesson:

146

147

Introduction [intro.html] Volcano Terminology [term.html] Volcanic Places in the USA [usa.html] Volcanic Places on Mars [mars.html] Research Project [proj.html]

Each part of the lesson will link back to the index as well as to the preceding and following pages. Also note the two-way link between usa.html and msh.html Or if you prefer a more traditional directory listing structure: existing file structure work area pictures lava.gif left.gif msh.gif seismo.jpg stamp.gif volcano volc.html msh.html volc index.html intro.html mars.html msh.html proj.html term.html usa.html new file structure work area pictures lava.gif left.gif msh.gif seismo.jpg stamp.gif

148

NOTE:To complete this lesson, we will have to create quite a few new files and do a fair amount of copy/pasting from the files you have been working on. Be sure that you are comfortable jumping around between the different application and document windows on your computer. Also, we have changed the name of the volcano directory/folder to a shorter volc. (We like trying to keep our URLs from getting too long, but also not shrinking them too short that they are cryptic) The first thing we will do is create the new index.html file, which will be the "cover" page for our Volcano Web lesson: 1. First make a copy of the index.html file you have been working on and name it old.html or something like that. This is a very good habit when you start making major changes to your web pages! 2. Now open the original version of the index.html file in your text editor. This is our lesson that we have been working on to this point. 3. We are going to use the picture, the opening text/quotation, and the table of contents as the content for our title page. To do this, we will remove the sections that will be "split" out to other web pages. Delete the sections from Introduction to Bilbiography, that is everything from: 4. <hr> 5. <h2><A NAME="intro">Introduction</a></h2> 6. A <b>volcano</b> is a location where magma, 7. or hot melted rock from within a planet, reaches the surface. : through
:

<dt>Lipman, P.W. and Mullineaux (eds). (1981) <dd><I>The 1980 Eruptions of Mount St. Helens, Washington.</I> U.S. Geological Survey Professional Paper 1250. </dl> You may want to compare your HTML file to an example of how it should look at this point. 8. Now look at the section labeled "In this Lesson..." In our previous work, we used hypertext links to jump to a named anchor (e.g. <a name="term">..</a>) in the same document (see lesson 8a). Now we will modify these anchor links so that each jumps to another web page (which we will create below).

149

Find the portion that reads: 9. <b>In this Lesson...</b> 10. <ul><i> 11. <li><a href="#intro">Introduction</a> 12. <li><a href="#term">Volcano Terminology</a> 13. <li><a href="#usa">Volcanic Places in the USA</a> 14. <li><a href="#mars">Volcanic Places on Mars</a> 15. <li><a href="#project">Research Project</a></i> </ul> and edit it to read: <b>In this Lesson...</b> <ul><i> <li><a href="intro.html">Introduction</a> <li><a href="term.html">Volcano Terminology</a> <li><a href="usa.html">Volcanic Places in the USA</a> <li><a href="mars.html">Volcanic Places on Mars</a> <li><a href="proj.html">Research Project</a></i> </ul> Compare your HTML file to an example of how it should look at this point. NOTE: Be sure you understand the difference between a link written: <a href="#quest">go to questions</a> and another one written: <a href="quest.html">go to questions</a> The next thing we will have to do is create the individual files for the other parts of our lesson. It will be easier if we first create a template file that we can modify for each of the different pages. 1. In your text editor, create a new file called temp.html 2. In this file, put the following HTML (If you wish, you can copy an example template file):

HTML
<html>

Notes
HEAD: In the head

150

<head> <title>XXXXXXXX</title> </head> <body> <h5>Volcano Web / <a href="index.html">Index</a> / <a href="xxxx.html">back</a> / <a href="xxxx.html">next</a></h5>

portion of each document, XXXXXXXX is the name of that section NAVIGATION: At the top of each page we use a small header (h=5) to create navigation links. Index points back to the main cover page. next and back link to the following and preceding pages. You will have to fill in the appropriate file name in for xxxx.html. Notice how this provides a common visual clue to each of our web pages. HEADER: Use a header=2 to put a title for that page.

<h2>XXXXXXXX</h2> : : : <hr> <address> <b><a href="index.html"> Volcano WebL</a> : XXXXXXXX </b><p> created by Lorrie Lava, <a href="mailto:lava@pele.bigu.edu"> lava@pele.bigu.edu</a> <br> Volcanic Studies, <a href="http://www.bigu.edu/"> Big University</a><p> <tt>last modified: April 1, 1995</tt> </address> <p>

ADDRESS FOOTER: Note how the footer is now set up to indicate the name of the main web page (with a link back to it) as well as a line of text that indicates the name of the current section XXXXXXXX. Placing the name of the page here adds another important visual clue to the location of this page in the structure of the web we are creating. <tt>URL: URL: Be sure to modify http://www.bigu.edu/web/xxxxxxxx.html the line that indicates the </tt> document's URL to reflect <p> its file name xxxxxxxx.html </body> </html> 3. Now you should make 5 copies of the template file and make the appropriate changes to the template: 151

File Name
intro.html

Section
Introduction

Notes
As this is the first section, remove the line from the navigation section: <a
href="xxxx.html">back</a>

term.html usa.html mars.html proj.html

Volcano Terminology Volcanic Places in the USA Volcanic Places on Mars Research Project As this is the last section, remove the line from the navigation section: <a
href="xxxx.html">next</a>

4. Now, open the old index.html file (that we re-named old.html) in your text editor. For each of the new files, you will have to copy the HTML that was underneath that section's <h2>...</h2> header and paste it into the new files you created in the previous step. Note that Volcanic Places in the US and Research Projects both include sub-sections that have <h3>...</h3> headers. 5. Finally, you will have to modify the link in msh.html file. Previously, it returned to a named anchor in the main lesson (the section for Volcanic Places in the US) where now it should link to the usa.html file. Open msh.html file in your text editor and edit the line to read: 6. <a href="usa.html"> 7. <img src="../pictures/left.gif" alt="** "> 8. Return to <i>Volcano Web</i></a> Just to be consistent, you should also make the footer look like: <hr> <address> <b><a href="index.html"> Volcano Web</a> : <a href="usa.html"> Volcanic Places in the USA</a> : Mount St. Helens</b> <p> created by Lorrie Lava, <a href="mailto:lava@pele.bigu.edu"> lava@pele.bigu.edu</a><br> Volcanic Studies, <a href="http://www.bigu.edu/">

152

Big University</a><p> <tt>last modified: April 1, 1995</tt> </address> <p> <tt>URL: http://www.bigu.edu/web/msh.html</tt> </body> </html>

Check Your Work


Compare your web pages with this sample of how it should appear. If your pages are different from the sample or the hypertext links do not work correctly, review the text you entered in the text editor. In this lesson we created quite a few files and it is very easy to make typographical errors.

Review
Review topics for this lesson: 1. What are some advantages of short, multiple web pages over a single, long web page? 2. What would have happened if we did not modify the hypertext link in the msh.html file? 3. What were the navigational features we added to our lesson?

More Information
Stylistically, your web pages are more readable if the hypertext links are integrated into the text of the content. This becomes more important as you create more web pages that have hypertext to link them together. Compare: "click here" links In the spring of 1980, most people living in the vicinity of Mount St. Helens took heed of the scientists' warning about an impending volcanic eruption. (Click here to see a picture of Mount St. Helens) However, several were insistent on staying in their homes and sadly perished in the May 18 event. In that same year, measured increases in seismic recording devices caused scientists to warn of a possible event in Long Valley, California, and order a large evacuation of the Mammoth resort area. (Click here to see a seismometer) However, no such event occurred, and residents were angrily resentful for what they

153

perceived as a false warning that caused great economic loss. integrated hypertext links In the spring of 1980, most people living in the vicinity of Mount St. Helens took heed of the scientists' warning about an impending volcanic eruption. However, several were insistent on staying in their homes and sadly perished in the May 18 event. In that same year, measured increases in seismic recording devices caused scientists to warn of a possible event in Long Valley, California, and order a large evacuation of the Mammoth resort area. However, no such event occurred, and residents were angrily resentful for what they perceived as a false warning that caused great economic loss. The "Click here..." hypertext not only disrupts the flow of the text, but the link text "here" is not related to the intended item. As a suggestion, avoid writing any lines like "click here to return to the home page". Instead, write a clean link, e.g. <a href="home.html">Home Page</a> -- the clicking is inherent in the use of the web browser. Make the content readable and choose the link words to clearly indicate that the link leads to something related.

Independent Practice
Take a look at the web page you are developing. Is it getting very long? Is there a logical division where you could "split" the page? Set up a cover/page index to your web pages and design appropriate links for navigating between them. Then design a template for your "sub-pages." Now ask some friends/colleagues to view your pages. Do they prefer the "split" pages or the "lumped" one? Could they easily negotiate their way through your information?

15. "Standard" and "Enhanced" HTML


Enter into the next realm of HTML. -- Here you will find more features and styles you can use in your web pages. But you will also face more issues to address as HTML becomes less "standard" (and more complex). Since you have worked so hard up to this point, here is a short lesson without any work to do! After this lesson you will be able to:

Decide whether to use HTML that may not work for all web browsers View the source HTML of any web page

154

We introduced you to the concept of "standard" HTML. The subsequent lessons in this tutorial will show you how to use some other HTML tags that may not be viewable on all web browsers. Here, we will just review some of the related issues before you venture ahead into the "danger zone." How about a little history? Long, long, ago ("in a galaxy far away?")... well around 1990, the World Wide Web was a text-based system based upon the HyperText MarkUp Language. The tags and interpretation were all built upon standards (HTML 1.0) set by an international committee. This was the key to the "web" becoming "world wide" because, by following the standards, the information was completely independent of the computer from which it was viewed. Even when NCSA Mosaic burst upon the scene in 1993 as the first graphical web browser (created by whiz kid Marc Andreessen and others), the standards were followed to the letter, which at that time were updated to HTML 2.0. The web started to get popular. Extremely popular. Insanely popular. Other programmers began to build web browsers that offered the same functionality as Mosaic (because they supported all of the HTML features contained within the international standards). A group that included the original developer of Mosaic formed a new company -- its mascot was "Mozilla", ("Mosaic" + "Godzilla") with a brand new web browser known as Netscape Navigator. Netscape was faster and more reliable than the NCSA Mosaic. It had a cool mascot! NetScape grew popular quickly perhaps because it contained functionalities that included all of HTML 2.0 PLUS more tags for things that you could not do in HTML 2.0. These "extensions" or "enhancements" have caused (and still cause) a great deal of arguments between HTML purists and those that like the "less than standard" features that Netscape added. The Mozilla Netscape was immensely popular and quickly grabbed 3/4 of the webbrowser pie. Now, in HTML, you could include colored backgrounds to your pages, formatted tables of text, text that wrapped around the side of images, and more. You began to see web pages that said, "This page optimized for Netscape". Other browsers began to include support for the Netscape "HTML 2.0+" features. As the major online services opened up to the web, the browser market got even more crowded (and noisy). The international commission was faced with a dilemma, as the market was largely demanding these "non-standard" tags to become part of HTML. As the rules for HTML

155

3.0 were being developed, they began to include most (but not all) of the tags Netscape had introduced. The standards process seemed to move too slowly for many people. And the battle grew bigger into 1996 when Microsoft introduced their own special HTML tags. Would HTML become more Babel-like? For more information about the HTML battle, we refer you to Andy King's HTML 3.0 and Netscape. The most recent action has been the proposal of HTML 3.2, which encompasses most of the features supported by the big players in the browser arena now, Netscape and Microsoft. The most recent position statement reflecting HTML 4.0 is the suggested standard that should be adopted by all web browsers. This latest evolution is meant to be a step that will provide a great deal of flexibility for future changes without them being mere "bolton" tags that have occurred to date. As we will see in later sections, Style Sheets provide a very efficient means for updating an entire web site with more consistent appearances, plus new features for easily internationalizing content and providing more accessibility features for the visually impaired. So what does this mean for you? As you develop web pages, you should consider what your readers will be using to access your pages. Perhaps you are a teacher in one school or an information department in a company that is sure all of their users will be using a particular browser. Then you can be comfortable designing and testing on only one browser. However, we consider this a short sighted approach that may down the road force you to do massive, tedious updates to your HTML coded pages. More commonly, you will be "publishing" web pages from an Internet server and have no idea what browser is being used or even what kind of computer it is used on. You can add special warnings to your page. You can stick closer to the standards that are most widely supported on all web browsers. Even if you do use special tags, there are usually ways to have an alternative that will not cause havoc for users of other browsers. Most importantly... do not become fixated on how the page looks on just your own computer! Your readers may have different browsers, different fonts, different text color preferences, different monitor sizes -- all of which may cause the display to vary in size, layout or appearance from how it looks on your computer. If you can try out your web pages on different computers, stretch and shrink the browser window, switch the standard fonts. Fortunately, the original design for HTML has a very open and forgiving set of rules -- if a browser encounters a tag it does not know how to deal with or display, it simply ignores these tags. For example, let's say my browser supports the <drip>...</drip> tag. This tag makes all text inside appears normal and then slowly "drip" toward the bottom of the page (editorial note -- I MADE THIS UP!), a fancy effect for my home page: <drip><H2 align=center>Welcome</H2></drip>

156

to my sloppy home page!. Look out for the puddles! which works like a charm on my home made browser because it has been programmed to understand how to display the <drip>...</drip> tags. On your browser that does not support this feature, you will see:

Welcome
to my sloppy home page!. Look out for the puddles! If your browser doesn't support this tag it just skips over it completely, rather than bombing or presenting an error message. It's a brilliant concept, isn't it?

Peeking at the Source


If you have not learned this already, the best secret for learning how to design web pages is to ... "creatively borrow". We are not advocating stealing HTML! But, if you find a web page design that you like, or find yourself asking, "How did they do that?" the easy thing to do is to look at their HTML code! It is sitting there waiting for you. This is one of the best responses to the question, "Why should I learn all of this darn HTML gunk when I can just use a visual editor such as ________________"? You cannot learn much from other websites if you depend upon a helper application to make your web pages. But... if you can "peek under the hood" of a web page and examine its HTML, you can understand and perhaps re-purpose interesting design techniques. The exact menu names for doing this are different depending on which web browser and version you are using. Typically, your web browser menu will have an item called View from which you can select Source or Page Source. When you select this, it will download the HTML source code corresponding to the URL of the current page in view, and display this HTML code for you to see. Another way to grab the HTML source of a page in view is to select Save as... from the File menu of your browser. This will bring up your familiar Save dialog box where you can select a location on your computer's drive and a file name. You should also see in the dialog box a pop-up menu labeled Format -- be sure to select the option labeled Source. NOTE: This will save for you the HTML file for the page in view... but not any of the images used in the page. Some newer web browsers as well as third party tools

157

provide the functionality to download everything in that web page as a single package. And a third way to get to the HTML source is to access the hidden menu-- right mouse click for Windows and Unix users, control-click for Macintosh users-- on any blank area of a web page. As practice, see how quickly you can see and save the HTML source code for this lesson page. As we go on into these more advanced lessons, the instructions will get a bit longer and more complicated. But you've gotten this far ok!

Review
1. Why should you care about the standards of HTML? 2. In what settings can you be most comfortable using non-standard HTML? 3. What happens when a browser encounters an HTML tag it does not understand? 4. If you see an interesting design of someone's web page, how can you learn how it was constructed?

158

HTML . HTML Hyper Text Markup Language <>Tags . ...... . notepad . lesson html <htm . :(.

951

. . . ></center ><center ></i ><i ></b ><b ></strike ><strike ></u ><u ..... ...

061

>1</h >1<h >2</h >2<h >3</h >3<h >4</h >4<h >5</h >5<h >6</h >6<h >5=<font size ---------- ----></font ></font >1=<font size ></font >2=<font size ></font >3=<font size ></font >4=<font size ></font >5=<font size

161

></font >"2+"=<font size ></font >"2-"=<font size . . <font face="Traditional Arabic, Arabic Transparent, Simplified >"Arabic ------------- -----------></font
261

. :

><html ><head ><title >/<title >/<head ><body -------------- -------------->/<body >/<html : ><html ><head

361

><title >/<title >/<head ><body >/<body >/<html ... . ><br ><p &;nbsp .. ><html >head> This is my page >title> Sayed
461

>/title> Sayed >/head> Im Doctor ><body My name is sayed saber .Here is my C.V Here is my name ><body &;nbsp &;nbsp &;nbsp &;nbsp ><p >/<body >/<html . . . .

561

: ><body bgcolor=#ffffff ------------>/<body ffffff . . # . . : >321321#=<font color ---------->/<font

font color . ... ...

661

. ........ . : ..... ><IMG SRC ........ 1image ><"IMG SRC="image1.jpg

761

.... .... HEIGHT , WIDTH >003"=<"IMG SRC="image1.jpg" HEIGHT="200" WIDTH

: ALT

861

: >"=IMG SRC="image1.jpg" ALT "<

: ..... .... ... BORDER >"4"=<IMG SRC="image1.jpg" BORDER

961

. . ..... !! .

... ... : >...</marquee...><marquee . :


071

<marquee direction=#> #=right , left ... ..... .

></marquee ><marquee direction=right

></marquee ><marquee direction=left

.<marquee behavior=#> #scrol,slide,alternate

></marquee ><marquee behavior=scrol

></marquee ><marquee behavior=slide

171

<marquee behavior=alternate> /<marquee>

< marquee loop=2 width=50% behavior=scroll> <marquee/>

/>< marquee loop=9 width=50% behavior=slide> <marquee

< marquee loop=1 width=50% behavior=alternate> <marquee/>

<marquee/>< marquee scrollamount=50>

172

..... ... ...: ><marquee bgcolor=lime >/<marquee ..... :

... ..... . ><marquee height=70 width=50% bgcolor=aaaeea ... >/<marquee

... .:(( ..... ..... .

371

Independent Practice Think of a topic for your own web page. Now create your own HTML text file that includes a <title> tag and a few introductory sentences. Save the HTML file and reload it in your web browser. You might want to create a different folder/directory for this file so you do not get it mixed up with all of the volcano pages you will create for this tutorial. Review Review topics for this lesson: 1. How did you re-open your workspace? 2. What steps did you use to make changes in your HTML document? 3. How did you display and view these changes in your web browser? Independent Practice As you did in the lesson, modify your own HTML document that you started in the last lesson. Add a few more sentences and see if you can successfully reload the modified document into your web browser.

Review Topics
1. 2. 3. 4. What are the different levels of headings in HTML? What are the tags associated with these different levels? What steps did you use in placing headings in your HTML document? What happens if you forget a slash at the end of a header tag?

174

HTML element
In computing, an HTML element indicates structure in an HTML document and a way of hierarchically arranging content. More specifically, an HTML element is an SGML element that meets the requirements of one or more of the HTML Document Type Definitions (DTDs). These elements have properties: both attributes and content, as specified (both allowable and required) according to the appropriate HTML DTD (for example, the HTML 4.01 strict DTD). Elements may represent headings, paragraphs, hypertext links, lists, embedded media, and a variety of other structures.

Syntactically HTML elements are constructed with: 1) a start tag marking the beginning of an element; 2) any number of attributes (and their associated values); 3) some amount of content (characters and other elements)'; and 4) an end tag. Many HTML elements include attributes in their start tags, defining desired behavior or indicating additional element properties. The end tag is optional for many elements; in a minimal case, an empty element has no content and requires no end tag. There are a few elements that are not part of any official DTDs, yet are supported by some browsers and used by some web pages. Such elements may be ignored or displayed improperly on browsers not supporting them. Informally, HTML elements are sometimes referred to as "tags" (an example of synecdoche), though many prefer the term tag strictly in reference to the semantic structures delimiting the start and end of an element. XHTML is the successor to HTML 4.01; XHTML 1.0 supports the same elements as HTML 4 and in most cases valid XHTML 1.0 documents will be valid or nearly valid HTML 4 documents. XHTML 1.0 migrates HTML from its SGML underpinnings to an XML foundation. Accordingly, the discussion of elements within this article focuses on the final SGML based HTML, version 4.01 (unless noted otherwise). However, to the extent that XHTML 1.0 elements remain identical to the HTML 4.01 elements, the discussion remains applicable (see HTML for a discussion of the minor differences in content between XHTML 1.0 and HTML 4.01).

175

Contents

1 Block-level and inline elements o 1.1 Nesting of elements 2 Document elements 3 Head elements 4 Inline o 4.1 General phrase elements o 4.2 Computer code phrase elements o 4.3 Special inline elements o 4.4 Links and anchors o 4.5 Images and objects o 4.6 Span element 5 Block o 5.1 General block elements o 5.2 Headings o 5.3 Tables o 5.4 Forms 6 Frames 7 Presentational markup o 7.1 Official o 7.2 Unofficial 8 HTML Comment 9 External links

[edit] Block-level and inline elements


HTML elements are classified as either block-level or inline (text-level). Block-level elements such as headings, paragraphs, lists, or tables are "large" structures containing other blocks, inline elements, or text (but see nesting rules, below). They are usually displayed as independent "blocks" separated from other blocks by vertical space (margins). Inline or text-level elements such as hyperlinks, citations, quotations, or images are "small" structures that represent or describe small pieces of text or data. They may contain only text or other inline elements, and are usually displayed one after another on a line within the block that contains them. (See "The global structure of an HTML document")

[edit] Nesting of elements

176

Many HTML elements can be nested, or contained within other HTML elements:
<p>You <em>rock</em></p>

Nesting can be more complex:


<p>King Louis said, <q lang="fr">L'tat, c'est <em>moi</em>!</q> (<cite><a href="/wiki/Louis_XIV_of_France">Wikipedia</a></cite>).</p>

Nesting may be arbitrarily deep, but the elements must be closed in the reverse order that they were opened for the code to remain valid (this pattern is known as Last in, first out). Incorrect Correct
<p>Mary kissed <em>Jimmy</em></p> <p>Mary kissed <em>Jimmy</p></em>

Some block-level elements (e.g. paragraphs) may contain only inline elements, and some (e.g. forms, lists) must contain only block-level child elements, but most may contain either block-level or inline elements.

[edit] Document elements


Root elements provide the containers enclosing all other HTML elements. Every HTML page has these elements. The surrounding tags may be omitted. However, some utilities may not recognize or correctly handle the document if this is done.
<html></html>

Delimit an HTML document (i.e. instead of an XML or another class document). The HTML element takes the attributes lang for the primary language for the document (such as en for English) and a profile for a URI specifying metadata for the document (rarely used). The only contents allowed in an HTML element is one head element and one body element. (See Frames, below, for an exception where body is not used.)
<head></head>

Delimit the header section of the document, which contains information about the page. The head element basically contains the metadata for the document. There are seven possible head elements including a meta element for extensible specification of metadata.
<body></body>

Delimit the body section of the document, which contains the displayed content of the page.

177

These root elements are arranged as follows: <html> <head> Any of the various head related elements arranged in any order and occurring any number of times except base and title which can only occur once each. Title is the only required head element. </head> <body> At least one of either a block element or a script element must occur,(though any number may occur), arranged in any order to suit the meaning and also typically the presentation of the document. The ins and del elements are also permissible within the body element when used as block level elements. The other block elements are: paragraph (p), heading (h1...h6), block quotation (blockquote), ordered list (ol), unordered list (ul), definition list (dl), division (div), no script support (noscript), form (form), table (table), fieldset (fieldset), and address (address). No other HTML elements are valid within the body element. </body> </html>

[edit] Head elements


<title></title>

Define a document title. This element is required in every HTML and XHTML document. Different user agents may make use of the title in different ways. Web browsers usually display it in the title bar when the window is open, and in the task bar when it is minimized. It may become the default filename when saving the page, Search engines' web crawlers may pay particular attention to the words used in the title element. The title element must not contain any nested tags (in other words it cannot contain any other elements). Only one title element is permitted in a document.
<base/>

Specifies a base URL for all relative href and other links in the document. Must appear before any element that refers to an external resource. HTML permits only one base element for each document. The base element has attributes, but no contents.
<link/>

Specifies links to other documents, such as 'previous' and 'next' links, or alternate versions [1]. An HTML head may contain any number of link elements. The

178

element has attributes, but no contents. A common use is to link to external stylesheets, using the form:
link <link rel="stylesheet" type="text/css" href="url" title="description of style" />[2] <basefont/> (deprecated)

Specifies a base font size, typeface and color of the document. Used together with font elements. Deprecated in favor of stylesheets.
<script></script>

Used to add JavaScript or other scripts to the document. The script code may be literally typed between the script tags and/or it may be in a separate resource whose URL is specified in script's optional src attribute. [3]
<style></style>

Specifies a style for the document, usually:


<style type="text/css"></style>

The CSS statements may be literally typed between the style tags and/or it may be in separate resources whose URLs are specified in @import directives such as: <style> @import "url"; </style>. [4]
<object></object>

Use for including generic objects within the head. Though rarely used as a head element, this could potentially be used to extract foreign data, relevant to the document, and associate this data with the current document.
<meta/>

Can be used to specify author, publication date, expiry date, page description, keywords and any other metadata not provided through the other head elements and attributes. Because of their generic nature, meta elements specify key-value pairs. In one form, meta elements can specify HTTP headers which should be sent before the actual content when the HTML page is served from web server to client. For example:
<meta http-equiv="foo" content="bar" />

This example specifies that the page should be served with an HTTP header called 'foo' that has a value 'bar' In the general form, a meta element specifies name and associated content attributes describing aspects of the HTML page. To prevent possible ambiguity, a third optional scheme attribute may be supplied to specify a semantic framework that defines the meaning of the key and its value. For example
<meta name="foo" content="bar" scheme="DC" />

179

In this example, the meta element identifies itself as containing the 'foo' element, with a value of 'bar', from the DC or Dublin Core resource description framework. For more specific information of the use of the meta element in HTML, see the W3C specification.

[edit] Inline
Inline elements cannot be placed directly inside the body element for valid HTML. They must be wholly nested within block-level elements (see block elements below).

[edit] General phrase elements


<em></em>

Emphasis (conventionally displayed in italics)


<strong></strong>

strong emphasis (conventionally displayed bold). An oral user agent may use different voices for emphasis.
<q></q>

A quotation containing only inline elements (for quotations containing block level elements see blockquote below). Quote elements may be nested. By the specification, the author should not include quotation marks. Rather, quotation marks including nested quotation marks should be rendered through stylesheet properties or the browser's default stylesheet. Practical concerns due to browser non-compliance may force authors to find work-arounds. The cite attribute gives the source, and must be a fully qualified URI. Note: within semantic HTML, the display of a lengthy inline quotation as an indented block should be handled through stylesheet presentation. One method is to use an XSLT to select quotation elements exceeding a certain length (in terms of characters or words, etc.) for indented block presentation. An alternative, using Cascading Stylesheets, requires some presentational markup to manually classify the element as a lengthy quotation. For example: <q class='lengthy'>An inline quotation of significant length (say 25 words, for example) goes here...</q>.
<cite></cite>

A citation. Reference for a quote or statement in the document.


<dfn></dfn>

Defining first instance of a term

180

<abbr></abbr>

Contains an abbreviation like HTML


<acronym></acronym>

Contains an acronym similar to the abbr element.

[edit] Computer code phrase elements


These elements are useful primarily for documenting computer code development and user interaction through differentation of source code (<code>), source code variables (<var>), user input (<kbd>), and terminal output (<samp>).
<code></code>

A code snippet. Conventionally rendered in a monospace font: Code snippet.


<samp></samp>

Sample output (from a program or script)


<kbd></kbd>

Keyboard - text to be entered by the user


<var></var>

Variable

[edit] Special inline elements


<sub></sub> <sup></sup>

Create subscript or superscript text: Equivalent CSS: {vertical-align: sub} or


{vertical-align: super} <del></del>

Deleted text. Typically rendered as a strikethrough: Deleted text.


<ins></ins>

Inserted text. Often used to markup replacement text for <del>'d text. Typically rendered underlined: Inserted text. Note, both ins and del elements may be used as block elements: containing other block and inline elements. However, these elements must still remain wholly within their parent element to maintain a well-formed HTML document). For 181

example deleting text from the middle of one paragraph across several other paragraph and ending in a final paragraph would need to use three separate del elements. Two del elements would be required as inline element to indicate the deletion of text in the first and last paragraphs, and a third, used as a block element, to indicate the deletion in the intervening paragraphs.
<isindex></isindex> (deprecated)

The :isindex element requires server side support for indexing documents. Visually presents a one-line text input for keyword entry. When submitted, the query string is appended to the current URL and the document is displayed with these keywords highlighted. Generally if the server supports this feature it will add the iisindex elements to documents without author intervention.

[edit] Links and anchors


<a></a>

<a href="URL" title="additional information">link text</a>

Creates an element that becomes a hyperlink with the href attribute set to a URL; additionally the attribute title may be set to a hover box text, some informative text about the link: In most graphical browsers, when the cursor hovers over the link, the cursor typically changes into a hand with a stretched index finger and the additional information pops up, not in a regular window, but in a special "hover box", usually similar to a Tooltip, which disappears when the cursor is moved away. Some browsers render alt text the same way, though this is technically incorrect. Alternatively (and sometimes concurrently), the element becomes an anchor with the name attribute set, which preceded by a number sign '#', and appended to the URL, acts as a link target (a "document fragment"), typically causing a Web browser to scroll directly to that point of the page. Any element can be made into an anchor by using the id attribute, so using <a name="foo"> is not necessary. See also:link

[edit] Images and objects


<img/>

Includes an image with the src attribute, the required alt provides alternative text in case the image cannot be displayed. Alt is intended as alternative text, although Microsoft Internet Explorer renders it as a tooltip; the title attribute is the tooltip text.
<br> <br/> (XML compatible)

Specifies a line-break. 182

<map></map>

Specifies a client-side image map.


<area> <area/> (XML compatible)

<object></object>

Specifies an area in the map. Includes an object in the page of the type specified by the type attribute. This may be in any MIME-type the Web browser understands, such as an embedded page, code to be handled by a plug-in such as Flash, a Java applet, a sound file, etc.

<param></param>

or <param/> This element may only appear inside an object element. Using attributes such as name and value, each <param/> sets a parameter for the object. Examples include width, height, font, background colour, etc, depending what has been exposed in this way by the object's developers. <embed></embed> (proprietary) Calls a plug-in handler for the type specified by the type attribute. Used for embedding Flash files, sound files, etc. This is a proprietary Netscape extension to HTML; <object> is the W3C standard method. <noembed></noembed> (proprietary) Specifies alternative content, if the embed cannot be rendered.
<applet></applet> (deprecated)

Includes a Java applet in the page. Deprecated; <object> is now preferred.

[edit] Span element


<span></span>

Creates an inline logical division. This may be used to identify a part of the HTML page, for example so as to apply an id or class attribute, which can then be referenced from CSS or DOM call. Like most HTML elements, span also supports inline CSS in its optional style attribute).

[edit] Block
Many HTML elements are designed for altering the semantic structure or meaning of a document. Some are block-level, but most are inline and can be included in the normal flow of text.

[edit] General block elements

183

Creates a paragraph, perhaps the most common block level element. The closing tag is not required in HTML.
<p></p> <blockquote></blockquote>

Contains quoted material when the quotation itself includes block level elements (for instance, quoting several paragraphs). The cite attribute may give the source, and must be a fully qualified Uniform Resource Identifier. The blockquote element is often misunderstood. It is an element meant to contain quotations that are themselves block level. In other words, it contains a complete paragraph or many paragraphs. In HTML strict DTDs inline elements are prohibited from blockquote elements. For quotations not containing block level elements see the quote (q) element.
<hr/>

Inserts a horizontal rule. Horizontal rules can also be handled through the CSS properties.

[edit] Headings
<h1></h1> <h2></h2> <h3></h3> <h4></h4> <h5></h5> <h6></h6>

Section headings at different levels. Use <h1> for the highest-level heading (the major sections), <h2> for the next level down (sub-section), <h3> for a level below that, and so on. The lowest level heading is <h6>. Most web browsers will show <h1> as large text in a different font, and <h6> as small bold-faced text, but this can be overridden with CSS. The heading elements are not intended merely for creating large or bold text: they describe something about the document's structure and organization. Some programs use them to generate outlines and tables of contents.

[edit] Tables
<table></table>

Creates a table
<tr></tr> <th></th>

Creates a row in the table. Creates a table header cell within a row; contents are conventionally displayed bold and centered. An aural user agent may use a louder voice for these items.

<td></td> <colgroup></colgroup> <col/> <caption></caption>

Creates a table data cell within a row. Specifies a column group in a table. Specifies attributes for an entire column in a table.

184

Specifies a caption for the entire table.


<thead></thead>

<tbody></tbody> <tfoot></tfoot>

Specifies the header part of a table. This section may be repeated by the user agent if the table is split across pages (in printing or other paged media). Specifies the main part of a table. Specifies the footer part of a table. Like <thead>, this section may be repeated by the user agent if the table is split across pages (in printing or other paged media)

[edit] Forms
These elements can be combined into a form or used separately as user-interface controls. Combined with a first-class javascript engine, these controls provide support for rich user interfaces. Main article: HTML form HTML specifies the elements that make up a form, and the method by which it will be submitted. However, some form of script either server-side or client side must be used to process the user's input once it is submitted.
<form action="url"></form>

Creates a form.
<select name="xyz"></select>

Create a menu list, from which the user can select a single option. May be rendered as a dropdown menu.
<option value="x"/>

Creates a menu item in a menu list.


<input type="checkbox"/>

Creates a checkbox. Can be checked or unchecked.


<input type="radio"/>

Creates a radio button. If multiple radio buttons are given the same name, the user will only be able to select one of them from this group.
<input type="button"/>

Creates a general-purpose button. But it's advised to use <button> if possible (i.e. if the client supports it) which provides richer possibilities. 185

<input type="submit"/>

Creates a submit button.


<input type="image"/>

Creates a button using an image. The image URL may be specified with the src tag.
<input type="reset"/>

Creates a reset button for resetting the form to default values.


<input type="text"/>

Creates a one-line text input. The size attribute specifies the default width of the input in character-widths. Maxlength sets the maximum number of characters the user can enter (which may be greater than size).
<input type="password"/>

Creates a variation of one-line text input. The only difference is that inputted text is masked: usually every character is shown as an asterisk or a dot. It should be noted, however, that the value is submitted to the server as clear text. So an underlying secure transport layer like HTTPS is needed if confidentiality is a matter.
<label for="name"></label>

Creates a label for a form input (e.g. radio button). Clicking on the label toggles the control.
<textarea rows="8"></textarea>

Create a multiple-line text area, the size of which is specified by cols and rows attributes. Text in between the tags appears in the text area when the page is loaded.

[edit] Frames
An HTML document may contain a header and a body or a header and a frameset, but not both. For frames the Frames DTD must be used.
<frameset></frameset>

Delimit the frameset. The frames layout is given by comma separated lists in the rows and cols attributes.
<frame></frame>

186

Delimit a single frame, or region, within the frameset. A different document linked with the src attribute appears inside.
<noframes></noframes> Contains a normal <body> element

with child elements that will appear in web

browsers that don't support frames.


<iframe></iframe>

An inline frame inside a normal HTML <body>, which embeds another HTML document. A similar effect can also be achieved using the object element. These approaches differ in some ways (World Wide Web Consortium [5]). See also Framing (World Wide Web).

[edit] Presentational markup


[edit] Official
The use of presentational markup is discouraged. The equivalent CSS should be used instead. Deprecated elements are only valid in the Transitional and Frameset variants of HTML 4.01 and XHTML1.0. They are invalid in the Strict variants of HTML 4.01, XHTML1.0 and XHTML 1.1. <b></b> and <i></i> are invalid in the current draft of XHTML2.0.
<center></center> (deprecated)

Creates a block-level centered division. May also center-align all text. Deprecated in favor of <div> or another element with centering defined using CSS.
<b></b> <i></i>

Use boldface type. Equivalent CSS: {font-weight: bold} Use italic type. Equivalent CSS: {font-style: italic}

<big></big>

Creates bigger text. Equivalent CSS: {font-size: larger}. <small></small> Creates smaller text. Equivalent CSS: {font-size: smaller} <s></s> (deprecated) <strike></strike> (deprecated) Create strike-through text: Strikethrough Equivalent CSS: {text-decoration: line-through} <tt></tt> Use a typewriter-like (fixed-width) font. Equivalent CSS: {font-family: monospace} <u></u> (deprecated) Use an underlined font. Equivalent CSS: {text-decoration: underline} <font></font> (deprecated) <font [color=color,] [size=size,] [face=face]></font> Can specify the font color with the color attribute, typeface with the face attribute, and absolute or relative size with the size attribute. Examples (all the examples are deprecated, use CSS equivalents if possible): 187

1. <font color="green">text</font> creates green text. See template:fontcolor. 2. <font color="#1f4099">text</font> creates text with hexadecimal color #1f4099. 3. <font size="4">text</font> creates text with size 4. Sizes are from 1 to 7. The standard size is 3, unless otherwise specified in the <body> or other tags. 4. <font size="+1">text</font> creates text with size 1 bigger than the standard.. <font size="-1">text</font> is opposite. 5. <font face="Courier">text</font> makes text with Courier font. Equivalent CSS for font attributes:
<font size="N"> corresponds to {font-size: Yunits} (the HTML specification does not define the relationship between size N and unit-size Y, nor does it define a unit). <font color="red"> corresponds to {color: red} <font face="Courier"> corresponds to {font-family: Courier}

[edit] Unofficial
These are unofficial presentational elements that may not be supported in all browsers.
<blink></blink>

decoration: blink} <marquee></marquee> (unofficial)

(unofficial) Causes text to blink. Can be done with CSS where supported: {text-

Creates scrolling text. No equivalent with CSS; use scripting instead. <nobr></nobr> (unofficial) Causes text to not return at end of line. Can be done with CSS: {white-space:
nowrap}

[edit] HTML Comment


<!---->

Encloses a comment. This is an SGML tag and not limited to HTML, so it may appear anywhere in the document, even before the DTD or after </html>. A client should render none of its enclosed contents. The closing ">" is required. For compatibility with some pre-1995 browsers, SGML comments are sometimes used inside <style> or <script> tags, but this is not necessary and may in fact cause undesired effects.

[edit] External links


188

Complete lists of elements and attributes for HTML 4.01

Retrieved from "http://en.wikipedia.org/wiki/HTML_element" Categories: World Wide Web | HTML


Views Personal tools

Article Discussion Edit this page History

Sign in / create account

Navigation Search

Go Search

Main page Community portal Featured content Current events Recent changes Random article Help Contact Wikipedia Donations

Toolbox

What links here Related changes Upload file Special pages Printable version Permanent link Cite this article

In other languages

189

Interlingua Italiano Lietuvi Nederlands Portugus

This page was last modified 23:42, 17 December 2006. All text is available under the terms of the GNU Free Documentation License. (See Copyrights for details.) Wikipedia is a registered trademark of the Wikimedia Foundation, Inc. Privacy policy About Wikipedia Disclaimers

190

[edit] References
1. ^ Raggett, Dave (1998). Raggett on HTML 4. Addison-Wesley, chap. 2: A history of HTML. ISBN 0-201-17805-2. 2. ^ Development of HTML 4.01 and XHTML 1.0 occurred in parallel throughout 1998 and 1999. In early 2000, after HTML 4.01 and XHTML 1.0 were published, the HTML Working Group's charter shifted to concentrate on XHTML. HTML working group charter (20002002). World Wide Web Consortium. Retrieved on 2006-09-14. HTML working group charter (2002 2004). World Wide Web Consortium. Retrieved on 2006-09-14. 3. ^ "W3C has no intention to extend HTML 4 as such. Instead, further work is focusing on a reformulation of HTML in XML, namely XHTML." HTML Working Group Roadmap. World Wide Web Consortium. Retrieved on 2006-0914. 4. ^ The "successor" reference is only in informal prose on the HTML Home Page, cited below. Additionally, the HTML 4.0 and 4.01 Recommendations each contain a hyperlink labeled "latest version of HTML" that, as of 2006, returns a copy of the latest edition of XHTML 1.0. 5. ^ HyperText Markup Language (HTML) Home Page. World Wide Web Consortium. Retrieved on 2006-09-14. This is the W3C's primary index of its current publications and activity relating to HTML and XHTML. It endorses both XHTML and HTML as current technologies. It also explicitly refers to HTML 4.0, 3.2, and 2.0, but not 4.01, as "Previous Versions of HTML". 6. ^ W3C Technical Reports and Publications (index of all current W3C publications). World Wide Web Consortium. Retrieved on 2006-09-14. This is the W3C's primary index of all its current publications. It endorses both XHTML and HTML as current technologies. 7. ^ Google web search using terms 'site:w3.org HTML "Rescinded Recommendation"'. Retrieved on 2006-09-14. This search indicates that no publications exist on the W3C web site stating that HTML has been advanced into the W3C's Rescinded Recommendation publication track. There is likewise an absence, in the W3C's XHTML-related Recommendations, of references or designation of any edition of HTML as 'obsolete', 'superseded', 'replaced', or 'deprecated', which are the terms the organization usually uses to discourage the use of one of its publications. [1][2][3][4][5] XHTML is not considered part of nor a mentioned as superseding the updates to HTML 4.01 as published in HTML 4 Errata. World Wide Web Consortium. Retrieved on 2006-09-14. 8. ^ http://www.useit.com/alertbox/20050103.html 9. ^ http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.2 10. ^ http://www.w3.org/TR/xhtml1/diffs.html#h-4.4 11. ^ http://www.cs.tut.fi/~jkorpela/qattr.html

191

192