A Web of Structured Documents
As a start, let us consider web to be a sea of documents (pages). In its very short lifetime, since its foundation, the web has grown to feature millions and billions of pages. For the time being, lets think of all these documents as pages, pages that are found in the web. Many of the pages we find in the web bear a strong resemblance to the documents in real life and mostly all these documents have a certain structure. For example, newspapers we read in the morning have structure like articles, pictures, advertisements, health tips and so on. Almost every article has a main heading, which might be followed by subheadings and pictures. This is a good example of a document in real life. On the same way, documents in the web also have this structure.
The web, however, does not understand the document we see in real life. A web browser if required for that purpose. The web browser renders the paragraphs, texts and pictures and shows them in a way required.The languages we need to learn in order to tell a web browser the structure of the document are HTML and XHTML.
Introducing HTML and XHTML
HTML is a markup language which is used to describe the documents present in the web i.e. the pages of the web. HTML stands for Hyper Text Markup Language and consists of a set of markup tags. HTML tags describe the HTML documents. And each tag describes a different content of the document. The initial type of HTML was printed by Tim Berners-Lee in 1993. Since then, there have been several dissimilar forms of HTML. The utmost extensively used form during the 2000's was HTML 4.01, which grew into an official tandard in December 1999.
XHTML documents must be declared. Below is shown the declaration of an XHTML document:
There are a few rules when creating an XHTML document.
A simple example of XHTML document is shown below:
Many documents on the Web today were assembled with either HTML 4.01 or XHTML 1.0. However, in recent years, the W3C (in association with additional association, the WHATWG), has been at work on a brand new form of HTML, HTML5. However, HTML 5 is by now extensively reinforced by browsers and other web-enabled devices, and is the technique of the imminent time.
Tags and Elements
Let us look at the example of a HTML document given above. There we can find pairs of angle brackets containing the letters ‘html’ as. The two brackets and all the characters in between in them are called a tag. And as we can see, there are a lot of tags in the example. All the tags in the example come in pairs, i.e. they have both opening and closing tags. A closing tag is somewhat different from an opening tag. The closing tag contains a forward slash (‘/’) before the characters.
An element contains the pair of tags (opening and closing) and the content inside the tags.
This is a paragraph.
All of the content from the first ‘less than’ angle bracket to the last ‘greater than’ angle bracket is an element.
Separating Heads from Bodie
An HTML document consists of two main parts: Head and Body. Every HTML document has aand atag each inside thetags.
Attributes tell us about elements
The attributes provide necessary information about an element. They are present on the opening tag of the element that carries them. Attributes are made up of two parts: name and value.
The name is the property we want to set whereas, the value is what we want the value of the property to be.
The value of the property should be put in double quote and to separate it from name, an equals sigh in used.
In the above example, the value for the property ‘color’ is ‘red’.
Learning from other by viewing their source code
Viewing source code means extracting the code for an already rendered web page. In browsers like Internet Explorer, Mozilla Firefox and Internet Explorer, you can go to view and select View Source. This gives you the html code for the web page.
However, there are two things you need to remember when looking into others source code.
Elements for marking up text
In HTML, there are various ways to markup the content of the document. Some general ways of markup are by using general structural elements like headings, paragraphs, embedding quotes and code.
For example, a heading is written in HTML as:Heading number one
-- this tends to present the text in the largest format
This element consists of all the content of the document in it. Theelement is has both opening and closing tags among which the opening tag is situated at the beginning of the document while the closing tag is situated at the end of the document.
TheelementThis element works as a container for all other header elements. In a HTML document, the openingtag should be the first to appear after the openingtag. Theelement must contain the: