5 Steps To Understand HTML
Creation of the HTML documents that would work as required on the web server is not an easy job despite the simplicity of HTML tags. It requires extra knowledge that is often not found in the books.
There are many things which need consideration, such as:
Understand Doctypes
It should be noted that valid HTML documents do not begin with <html> tag. There is a tag called doctype before it. It is mandatory for this tag to be present on top of the HTML document for it to become a valid HTML.
The two major Doctypes are:
* HTML4 doctype
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
* XHTML doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Doctypes are basically used to inform the browser about the exact version of HTML used for writing the page and to ensure that it is interpreted correctly.
Understand HTTP Errors
Most of the people who write HTML have no knowledge about HTTP's functioning. Due to this reason, they face a lot of problems. HTTP is the way by which a web browser communicates with the server. This communication includes information about the web pages like cookies. It works when the browser sends a request to the server for a page. The server responds by sending back a code.
Websites should be programmed to handle error codes too. Some of the common error codes are:
-
200 - OK
-
301 - Page has been moved
-
403 - Forbidden
-
500 - Internal server error
Understand MIME Types
MIME types are important parts of the HTML header. They are also known as content-type headers which specifies the kind of file that it is going to be sent. The browsers do not depend on HTML files ending with .html or JPEG files ending with jpeg. They depend on content-type header.
Some of the widely-used MIME types are:
-
text/html - HTML
-
text/css - CSS
-
text/plain - plain text
-
image/jpeg - JPEG image
-
image/gif - GIF image
-
audio/mpeg - MP3 audio file
-
application/x-shockwave-flash - Flash movie
Understand Link Paths
The number of different things that can be put up in an 'href' property is one of the most difficult things to understand in HTML. Some examples of abbreviated URLS created with its use are:
<a href="example2.html"> - links to www.example.com/example1/example2.html
<a href="../example2.html"> - links to www.example.com/example2.html
<a href="./example2.html"> - links to www.example.com/example1/example2.html
<a href="."> - links to www.example.com/example1
<a href=".."> - links to www.example.com/
In each of these, it was assumed that the link on the page is: www.example.com/example1/example1.html.
One dot stands for the current folder, whereas two dots stand for “in the folder above the one that we're in”. This is often quite confusing.






















