HTML: A Gentle Introduction
HyperText Markup Language (HTML) is a simple language for representing document format styles and links to other documents or media types, such as images or sound recordings. HTML can be used to create documents which contain styles such as underlined or bold-faced text. It can also be used to mix text, images, and sounds into a single document, the individual elements of which may be located on geographically distant systems around the world.
HTML is designed to create documents for the World Wide Web and it helps determine what is displayed when you are browsing documents with your favorite WWW browser. You can use it to create your home, or welcome page or to create a research document, article, or book. This document can then be viewed locally or made accessible for viewing by other Web surfers through the use of a WWW server, such as NCSA's or CERN's httpd daemon. This article introduces you to HTML basics so you may get started creating your own HTML documents.
You can use your favorite text editor to create an HTML document. The document will be composed of text, which will be displayed directly to the user, and markup tags, which are used to modify the appearance of the text or to incorporate images or sounds as part of the document. Tags are also used when referencing other documents or different locations within a document. Document references are called hypertext links or simply “links”.
A tag for indicating the start of a particular format is represented as a tag name enclosed in a pair of angle brackets. To indicate the termination of a format, the tag name is prefixed with a /. For instance, <I>Italics</I> would display the word “Italics” in italic format. Let's examine a simple HTML document.
<HEAD> <TITLE>Sample Document</TITLE> </HEAD> <BODY> <H1>A Sample HTML Document</H1> Here is some <B>Bold text</B>, and here is some <I>Italic text</I>. </BODY>
This makes use of a few basic tags. The text between the <HEAD> and </HEAD> tags is the document header. The header contains a <TITLE> tag which indicates the start of the document title tag and is terminated by a </TITLE>. The title usually isn't displayed as part of the document text by most browsers, but instead is displayed in a special location. For instance, Mosaic displays the title in the title box at the top of the browser window.
After the header is the body of the document, which is contained between the <BODY> and </BODY> tags. Inside the body the <H1> represents the start of a first level document heading. There are six levels of headings. Each increase in level results in a decrease in the prominence with which a heading is displayed. For instance, you might want to use an H1 heading for displaying the document title in the document text, and then use H2 for subheadings.
This is probably a good time to mention that tags are case-insensitive. Thus <TITLE> and <title> are the same tag; however, I will continue to capitalize document tags for clarity.
Physical format styles are used to indicate the specific physical appearance with which to display text. The following is a list of physical format tags:
Displays text in bold face.
Displays text in italics.
Displays text underlined.
Displays text using a typewriter font.
The problem with physical formats is that there is no guarantee that a particular browser will display the text as expected. A user may modify the fonts that a browser uses, or the browser may not even have the specified font style available. For instance, if a text mode browser is used to display a document, it is unlikely that italic text can be displayed at all. To avoid the ambiguity associated with the display of physical formats, you may use logical format tags. In fact, it is usually recommended that you use logical format tags, in preference to physical format tags, wherever you can.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- Vigilante Malware
- Non-Linux FOSS: Code Your Way To Victory!
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Vagrant Simplified
- Libreboot on an X60, Part I: the Setup
- Dealing with Boundary Issues
- Bluetooth Hacks
- System Status as SMS Text Messages
- New Products
- October 2015 Issue of Linux Journal: Raspberry Pi