CSS Cheat Sheet (V2)
30 June 2008 | 357 comments | cheatsheet, css, design, html, reference, webdesign
The second version of the CSS Cheat Sheet, a quick reference guide for CSS, listing selector syntax, properties, units and other useful bits of information.
HTML Cheat Sheet
8 January 2007 | 125 comments | webdev, development, cheatsheet, xhtml, reference, html, web, design, webdesign, tools, css, programming
HTML is the language of the web. It is the semantic support on which websites depend. This A4 reference lists the various tags available to the web designer, as well as a selection of useful character entities, attributes and events.
Microformats Cheat Sheet
9 September 2006 | 49 comments | webdev, cheatsheet, standards, xhtml, html, reference, microformats, programming, web, pdf, hcard, webdesign
Microformats allow us to add more information to our documents on the web, embedding semantic data in web pages that can then be parsed and used in other applications. This reference sheet contains an overview of the most often used microformats.
HTML Character Entities Cheat Sheet
29 September 2005 | 83 comments | webdev, cheatsheet, html, reference, xhtml, web, characters, useful, entities, webdesign, character
I'm forever looking up character codes, so this cheat sheet was a no-brainer. This contains a list of the assigned character codes in HTML, with an example of how they are displayed, and description.
"Select All" JavaScript for Forms Posting to an Array
28 July 2005 | 55 comments | select, html, php, array, forms, javascript, checkboxes, form, all
The problem that led to this snippet of code was that when posting from a form to a PHP script, you may sometimes want to have several fields with the same name and different values. For example, you might want people to be able to tick boxes to indicate which cities they have been to from a list. You would normally add "[]" to the name of the field inputs, like so:
<input type="checkbox" name="cities[]" value="London"> London
<input type="checkbox" name="cities[]" value="Paris"> Paris
<input type="checkbox" name="cities[]" value="Berlin"> Berlin
<input type="checkbox" name="cities[]" value="Madrid"> Madrid
<input type="checkbox" name="cities[]" value="Rome"> Rome
When the form is received by PHP, whichever items are ticked in the cities list above are accessible in the array $_POST['cities']. This is very handy.
Unfortunately, the addition of square brackets causes trouble with JavaScript, especially with a "Select All" function - which allows you to check all boxes at once by clicking a single one. This script works around that using regular expressions.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Checkbox Fun</title>
<script type="text/javascript"><!--
var formblock;
var forminputs;
function prepare() {
formblock= document.getElementById('form_id');
forminputs = formblock.getElementsByTagName('input');
}
function select_all(name, value) {
for (i = 0; i < forminputs.length; i++) {
// regex here to check name attribute
var regex = new RegExp(name, "i");
if (regex.test(forminputs[i].getAttribute('name'))) {
if (value == '1') {
forminputs[i].checked = true;
} else {
forminputs[i].checked = false;
}
}
}
}
if (window.addEventListener) {
window.addEventListener("load", prepare, false);
} else if (window.attachEvent) {
window.attachEvent("onload", prepare)
} else if (document.getElementById) {
window.onload = prepare;
}
//--></script>
</head>
<body>
<form id="form_id" name="myform" method="get" action="search.php">
<a href="#" onClick="select_all('area', '1');">Check All Fruit</a> | <a href="#" onClick="select_all('area', '0');">Uncheck All
Fruit</a><br><br>
<input type="checkbox" name="area[]" value="1" />Apples<br />
<input type="checkbox" name="area[]" value="2" />Bananas<br />
<input type="checkbox" name="area[]" value="3" />Chickens<br />
<input type="checkbox" name="area[]" value="4" />Stoats
<br><br><a href="#" onClick="select_all('location', '1');">Check All Locations</a> | <a href="#" onClick="select_all('location',
'0');">Uncheck All Locations</a><br><br>
<input type="checkbox" name="location[]" value="1" />Brighton<br />
<input type="checkbox" name="location[]" value="2" />Hove<br />
</form>
</body>
</html>
CSS Cheat Sheet (V1)
30 April 2005 | 221 comments | webdev, cheatsheet, development, tutorial, reference, tips, programming, design, web, webdesign, css, html, howto
A quick reference guide for CSS, listing selector syntax, properties, units and other useful bits of information.
Learn how and why you should add a robots.txt file to your website.
The Box Model For Beginners
9 July 2004 | 41 comments | box, boxmodel, css, design, html, model, reference, tips, tutorial, webdesign, webdev
An explanation of what the box model is and how it is treated by different user agents.
A tool to help automatically fix most common (X)HTML errors before outputting a page to the user.
Faux Columns for Liquid Layouts
22 June 2004 | 30 comments | tutorial, html, fluid, layout, reference, liquid, design, web, faux, webdesign, css, hacks
Using CSS for layouts can be a problem when using backgrounds for two columns that are not of equal length. This article expands on the solution to this problem from AListApart.
HTTP Status Codes for Beginners
11 May 2004 | 34 comments | development, html, http, reference, software, web, codes, tools, status, rest, apache, webdev
All valid HTTP 1.1 Status Codes simply explained.
DTDs, Document Type Definitions, are rarely used by web designers, but they are absolutely essential in HTML code.
Accesskeys enable a user to navigate a site using keyboard shortcuts, improving both the usability and accessibility of your site.
US States Select Box
14 February 2004 | 28 comments | select, webdev, development, html, reference, resource, design, forms, webdesign, states, resources
A populated select list (input box) with the states of the USA as options.
META tags are rarely used well, but can be a boost to your search engine placement. This guide explains which tags to use and how to use them effectively.
Countries Select Box
24 October 2003 | 31 comments | list, select, countries, html, resource, design, forms, webdesign, form, resources
A populated select list (input box) with the countries of the World as options.
RGB Hex Colour Chart
22 September 2003 | 61 comments | hex, cheatsheet, webdev, rgb, reference, color, html, webdesign, tools, css, colour, guide, design
A free, printer-friendly RGB Hex colour chart for web designers.