I was wondering if a web page is a program. If so, what programming language is used for development? Or are all web page simple documents?
I love your questions. They might seem very basic but I can assure you the answers are not! That said, I’m going to provide a detailed explanation, without much technical jargon, which I hope would clear the doubts in your mind.
But before we delve into that, let us first define what a web page is. To keep things simple, a web page is the document that’s displayed in a web browser.
Traditionally web pages were created using the HyperText Markup Language. Though HTML is a computer language, it is NOT a programming language in the strict sense. Why? Because it lacks the basic elements of one (we’ll come to this in a moment).
The main job of HTML is to define the various parts of a document and this is done through tags. For instance, a few words of the previous sentence were put in bold using the HTML <strong> tag. Similarly, if one has to designate a paragraph or a heading in a document, one would use the <p> and <h1> tags, respectively. A document can be formatted completely using just HTML tags. Page elements like tables, subheadings, ordered and unordered lists etc. can all be defined with HTML.
Most HTML tags come in pairs – an opening and a closing tag. After all, when you are putting something in bold, for instance, you would have to specify the beginning and the end, right? There are a few tags that don’t have to be “closed”. A good example of this is the <img> (image) tag by which one can embed an image on a web page.
Following is a simple paragraph with HTML code:
<p><b>HTML</b> is <i>NOT</i> a programming language.</p>
This is displayed as:
HTML is NOT a programming language.
The eagle-eyed would have noticed that the closing HTML tag has forward slash. The <b> tag bolds the text it surrounds while <i> put text it italics. Also, the whole sentence is defined as a paragraph with the <p> tag.
Nowadays, it is common to create web pages using server-side programming languages. For instance, the text of this very page is stored in a database and is displayed in your web browser by PHP which is a popular server-side language powering sites like Facebook! To know more, read about the differences between client side and server side programming languages.
PHP code is processed by an interpreter (implemented as a native module on a server) or a CGI executable. [more...]