CodeLair website tutorials, articles & scripts

Welcome to CodeLair

We have lots of tutorials on HTML, CSS, JavaScript, PHP and more!

Deprecated HTML 4 elements

Published: 18 February 2007

There are several HTML elements and attributes that have now been declared deprecated by the World Wide Web Consortium (the organization that sets HTML standards). “Deprecated” means that the elements no longer serve a purpose and have been replaced by other methods, mostly involving cascading stylesheets (CSS).

Although it is recommended that web browsers continue to support them, eventually they will become obsolete. This page lists all the deprecated elements and attributes of HTML 4, and specifies the recommended replacements for them. You will need a basic understanding of CSS to implement most of these.

Continue reading Deprecated HTML 4 elements

Tables in HTML

Published: 14 February 2007

This tutorial will show you how to create HTML tables for displaying data in an organized fashion, including some neat CSS styling tricks.

Tables provide a convenient method of displaying and arranging data and other content. No doubt you are familiar with tables from other contexts - they are commonplace in word processing documents, and spreadsheets are in fact one giant table. Tables can be quite easily constructed in WYSIWYG HTML editors such as Dreamweaver or FrontPage, but for a number of reasons it really is worth knowing how the HTML code behind them fits together.

Continue reading Tables in HTML

Image Rollovers

Published: 5 April 2005

No doubt you’ve seen this kind of thing. When you hover your mouse over an image, it changes colour, or the image changes completely. With Javascript, you can make images change when you move your mouse over them. This is very useful for image links and the like. This tutorial will show you how.

Continue reading Image Rollovers

PHP Hit Counter

Published: 3 April 2005

This script will allow you to track the number of (non-unique) visitors to your site, or to each page.

The first part shows how to put a very simple hit counter on your pages. When a visitor loads the page, the count (stored in a file) is incremented. You can also choose whether or not to display the hit count on your pages. The second script below is similar to the first, however this one keeps track of the number of hits to each page separately and displays the hit counts in order of popularity.

Continue reading PHP Hit Counter

PHP Includes

Published: 30 March 2005

The ‘include’ function in PHP is probably one of the most useful of all of them. Using this, you can import any document from anywhere into your web page dynamically. If you have dozens of pages with the same navigation, don’t you find it annoying when you want to add a page to the link list? With PHP include you can write one page with the navigation and import it into every page on your site. And when you change this navigation page, the navigation on every page changes too!

Another use of this is to create one page with your design, then use GET parameters in the URL to display the required content. Below we’ll run through a few of the different uses of includes.

Continue reading PHP Includes

Everything Random in JavaScript

Published: 29 October 2004

Ever wanted to display a random quote or image on your pages? Or perhaps you’ve got some links to other sites, and you want to put a random one on a page. This tutorial will explain how to do all these. We’ll utilise the Javascript built-in random functions to display random quotes, images, or a anything you like!

Continue reading Everything Random in JavaScript

Draw Your Own Cartoon Images

Published: 23 October 2004

This tutorial will teach you how to make your own cartoon pictures, sometimes called “grabpics”, using an image editor. Using this method they come out totally clean and high quality.

We use Paint Shop Pro (version 5-7) in this article but the process applies to other image programs such as Photoshop or GIMP. The basic process is to use the line tool to trace over an image/screenshot on a new layer, colour it in, then delete the original image. Let’s get started!

Continue reading Draw Your Own Cartoon Images

Basic CSS tutorial

Published: 22 October 2004

Cascading Style Sheets (CSS) are a valuable tool for adding consistency to your web pages. You can change the look of your whole website quickly and with the minimum of fuss. This tutorial will help you get to know CSS and its capabilities - it explains the basic syntax for CSS, lists the most common CSS rules and explains how to apply them to your pages.

Continue reading Basic CSS tutorial