Category: Basics

A series on fundamental knowledge of web development, aimed at beginners.

Quick testing for console.log

I’m happy to see that IE8 includes native support for console.log, the JavaScript command which writes information to your preferred debugging tool (mine is Firebug). If you leave it in your code – as I did on my latest project – it throws an error in IE7 & below.

The way around it is to quickly check that the command is supported by your browser, and to provide an alternative (I use that old standby, alert) if not; and the quickest way to do that is with the if…else shorthand:

window.console ? console.log(foo) : alert(foo);

Custom markup for Microformats

A mistake which seems to be fairly common when taking the first steps in learning about Microformats (and one which I have made) is to presume that the markup which is generated by the generation tools – for example, the hCard Creator – is the markup that must be used in the page.

That’s not the case, of course; with a few notable exceptions, the markup is completely customisable, and it is the order of the class names (and other attributes) which matters.

Read the full article


Grid alignment without frameworks

When building a small site or blog template with a grid-based layout I find ‘CSS frameworks’ such as Blueprint and YUI Grids are overkill; they contain a lot of extra CSS rules which I don’t use. They are (in the vernacular) like using a sledgehammer to crack a nut.

What I do instead is much simpler; I use an extra stylesheet just for testing, and a single PNG image tiled across the background.

Read the full article


Explaining the C in CSS

After being a developer for a while you sometimes forget that there are a lot of people still learning. With that in mind — and working on the assumption that the more information that’s available, the easier it is to find — I’ve decided to start an occasional series of web development basics tutorials.

One of the things I see a few people struggle with when learning CSS is the concept of the cascade. I admit that as your stylesheets get more and more complicated, so the cascade gains in complexity with it. At it’s core, however, it’s pretty simple. There are three things you need to keep in mind: order, specificity, and inheritance.

Read the full article


Newer

Aside

I’ve updated my Speaking page to include more conferences, more videos, and a little on my speaking requirements and preferences. I’m planning to cut down on the number of talks I give in 2014 (twelve is too many), but am always open to interesting offers and opportunities, so please get in touch if you’re organising an event.

[#] 1 Comment