HTML, the language of the Web
What does a web browser (client software) do with a file it receives from a web server (server software)? Does it just display it to the human user as is? The answer is yes and no. Actually, in some cases, the web browser will display a document exactly the way it receives it from the web server. For example, if the document requested is an image, the web browser will display it directly. Similarly, plain text files will be displayed just as they are sent.
However, if the document is an HTML document, the web browser will "interpret" the HTML and display it according to the instructions contained within the HTML code. What is HTML code and why must it be interpreted? HTML (Hyper Text Markup Language) is a very simple language used to "describe" the logical struture of a document.
Although HTML is often called a programming language it is really not. Programming languages are 'Turing-complete', or 'computable'. That is, programming languages can be used to compute something such as the square root of pi or some other such task. Typically programming languages use conditional branches and loops and operate on data contained in abstract data structures. HTML is much easier. HTML is simply a 'markup language' used to define a logical structure rather than compute anything. It is a semantic issue, but one which you should be aware of.
The language itself is simple and follows a few important standards. Document description is defined by "HTML tags" that are instructions embedded within a less-than (<) and a greater-than (>) sign. To begin formatting, you specify a format type within the < and the >. Most tags in HTML are ended with a similar tag with a slash in it to specify an end to the formatting. For example, to emphasize some text, you would use the following HTML code:
this text is not bold <EM>this text is bold</EM> this text is not bold
It is important to note that the formatting codes within an HTML tag are case-insensitive. Thus, the following two versions of the bold tag would both be understood by a web browser:
<em>this text is bold</em> this text is not <EM>this text is bold</EM>
You can also compound formatting styles together in HTML. However, you should be very careful to "nest" your code correctly. For example, the following HTML code shows correct and incorrect nesting:
<CENTER><EM>this text is bolded and centered correctly</EM></CENTER>
<EM><CENTER>this text is bolded and centered incorrectly</EM></CENTER>
In the incorrect version, notice that the bold tag was closed before the center tag, even though the bold tag was opened first. The general rule is that tags on the inside should be closed before tags on the outside.
Finally, HTML tags can not only define a formatting option, they can also define attributes to those options as well. To do so, you specify an attribute and an attribute value within the HTML tag. For example, the following tag creates a heading style aligned to the left:
<H2 ALIGN = "LEFT">this text has a heading level two style and is aligned to the left </H2>