Foreword
Apologies to our regular readers if this comes as a jolt, but I’m going tech in this one…
I’ve been using a new programming technique for markup, known as Zen Coding. It’s a combination of XPath and CSS syntax that greatly speeds up markup generation.
For example, to automatically create the following markup…
<ul id="nav">
<li class="tier1"><a href="#" class="tier1"></a></li>
<li class="tier1"><a href="#" class="tier1"></a></li>
<li class="tier1"><a href="#" class="tier1"></a></li>
<li class="tier1"><a href="#" class="tier1"></a></li>
<li class="tier1"><a href="#" class="tier1"></a></li>
</ul>
…you need only type the following Zen Coding snippet:
ul#nav>li.tier1*5>a[href="#"].tier1
It’s a really elegant, streamlined syntax and something I’ve found incredibly useful so far. It doesn’t affect your source code, because it’s just an inline helper in your editor — a bit like auto-complete in Word, or Intellisense in Visual Studio.
The best thing is that Zen Coding is available as an add-on for loads of different programs – on PC and Mac – including 3Sixty’s two favourite code editors:
- Visual Studio
—via a download from Codeplex - Komodo Edit
—go to Tools → Add-ons and select Zen Coding from the list
You can find out more about Zen Coding over at Smashing Magazine.
