An HTML document is a file containing Hypertext Markup Language, and its filename most often ends in the .html extension. An HTML document is a text document read in by a Web browser and then rendered on the screen.
Definition of an HTML Document
An HTML document is a file containing hypertext markup language. HTML code is based on tags, or hidden keywords, which provide instructions for formatting the document. A tag starts with an angle bracket and the ‘less than’ sign: ‘;‘. The tag ends with an angle bracket and the ‘greater than’ sign ‘;‘. Tags tell the processing program, often the web browser, what to do with the text. For example, to make the word ‘Hello’ bold, you would use the opening bold tag <b> and then the closing bold tag </b>, like this:
Types of HTML
The newest version of HTML, which is entering the industry, is HTML 5. HTML can be divided into three categories: transitional, strict, and frameset. These types apply to how HTML is used, not necessarily to the selection of tags.
Transitional is the most common type of HTML. It has a flexible syntax, or grammar and spelling component. Over the years, transitional HTML has been used without syntax restrictions, and browsers support a ‘best effort’ approach to reading the tags. If tags are misspelled, the browsers do not correct web developers’ errors, and they display the content anyway. Browsers do not report HTML errors – they simply display what they can. This is the ‘best effort’ concept.
The strict type of HTML is meant to return rules into HTML and make it more reliable. For example, the strict type requires closing all tags for all opened tags. This style of HTML is important on phones, where the processing power may be limited. A clean and error-free code helps to load pages faster.
Finally, a frameset allows web developers to create a mosaic of HTML documents where multiple documents can be connected into a single screen. This technique is often used to create a menu system. You click on a menu item on the left side of the screen, and only the right side of the screen re-loads. The menu stays in place.
Let’s take a look at a few examples. To execute the examples, simply create a text document on your desktop called ‘test.html’. If you are using a Notepad program, please make sure the extension on the file is .html, not ‘test.html.txt’. To do this, use ‘Save As’ in Notepad and then include in a double-quote the name of the file ‘test.html’. On your desktop, you will see an icon with ‘test’ as the name, and the picture on the icon will have a web browser association.
If you chose to skip the header notation (and many web developers do skip it), the transitional HTML will be assumed. Our first example will introduce a <br /> tag. This is a new line tag, or a break tag. Insert the following into your document:
Hello world.<br />This is my first HTML document
This example will display the text in the browser in two lines. ‘Hello world’ will be on the first line, and ‘This is my first HTML document’ on the second line.
Now, let’s add more variation to the example:
;h2;Hello world.;/h2;;br /;;br /;This is my ;i;first;/i; HTML document
In this example, ‘Hello world’ will be displayed as large text. ;h2; is a header tag, which makes the text bold and large. Next, we have two new lines, then the word ‘first’ is in italics.
Here is yet another addition to the example:
;h1;My First Heading;/h1;
world.;/h2;;br /;;br /;This is my ;i;first;/i; HTML document
Note that, even though in the HTML code there is a new line break after the word ‘Hello’, the browser will display ‘Hello world’ on the same line. This is the case, because the browser only looks at HTML tags, not the style of the code itself. You can put many new lines between ‘Hello’ and ‘world’ and it will still appear on the same line.
An HTML document is based on a file containing hypertext markup language. In HTML, tags, or hidden keywords, tell processing programs, often Web browsers, how to display text. There are three categories of HTML: transitional, strict, and frameset. Transitional is the most common type of HTML while the strict type of HTML is meant to return rules to HTML and make it more reliable. Frameset allows Web developers to create a mosaic of HTML documents and a menu system.