7 The language of the web
Making the web appear in your web browser may be thought of as a special form of application programming. Typically, modern web sites divide this programming into three parts: content, style and behaviour.
The content of a web page is put together using hypertext markup language (HTML), the language of the web, which your browser understands. A browser needs a set of codes to identify the various parts of the web page: the headings, lists, paragraphs and so on. These codes are called tags in HTML and they make it possible for a web page to be displayed in a browser. HTML tags are standardised so that they can be interpreted by different browsers. HTML describes the structure of a web page, but how about formatting the page?
Well-designed web page presentation is vital for readability and appeal. The appearance of a page is greatly simplified by the use of stylesheets. A stylesheet is code used to format a page in a desired way: the presentation information goes in special
- Inline – literally inline with the HTML, hence formatting and describing the page contents at the same time, all mixed together.
- Internal – by grouping all the formatting commands in to one part of the HTML document into a stylesheet. This simplifies applying the same style across a document, because you need only define it once.
- External – by using an external CSS file, to which each page can link. Now you can apply a common style to all the documents in your website.
Just as we can separate content (or structure) and formatting (or presentation) by putting the CSS in a separate file from the HTML web page, you can separate content from how the page behaves, how it responds to the user. Actions, such as validating a user email, is generally performed using the JavaScript programming language. You can use flowcharts to design a JavaScript program. Just as stylesheets can be linked to from HTML pages, so can JavaScript files. Hence, the one script can serve on many pages, which means you need only write the code to check for a valid email address once and then call it whenever you need it from any page in your website.
There are several other special application languages, such as Structured Query Language for working with databases. You will encounter these if you choose to take your study of computer programming further.