Category: Basics
A series on fundamental knowledge of web development, aimed at beginners.
A series on fundamental knowledge of web development, aimed at beginners.
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);
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.
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.
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.