Learn how to Write Lightning-Fast Code in 4 Minutes: Screencast
videos

Learn how to Write Lightning-Fast Code in 4 Minutes: Screencast

We all know the benefits of using snippets and bundles to speed up our coding, but what if we could take things a step further, and turn a complex html structure into something as simple as a CSS selector? Well, thanks to a new project, called Zen-Coding, we can do this very thing!

In this four-minute video quick tip, I’ll demonstrate how.

Download Zen-Coding

Other Viewing Options

Update

Within the comments below, I made a suggestion that it would be neat if we could also paste in the generic “lorem” text, like so:

div#header>p>lorem

This would generate something like so:

<div id="header">
	<p>
		Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
	</p>
</div>

Unfortunately, I didn’t know how to do it. But luckily, the author of Zen-Coding, Sergey, was able to help me. I recorded a sixty second screencast showing you how to allow for this. You can watch it here.

Additional Resources

Write a Plus Tutorial

Did you know that you can earn up to $600 for writing a PLUS tutorial and/or screencast for us? We’re looking for in depth and well-written tutorials on HTML, CSS, PHP, and JavaScript. If you’re of the ability, please contact Jeffrey at nettuts@tutsplus.com.

Please note that actual compensation will be dependent upon the quality of the final tutorial and screencast.

Write a PLUS tutorial

Add Comment

Discussion 139 Comments

Comment Page 1 of 21 2
  1. sideshow says:

    This is awesome! I’ll try it! Cool stuff – thanx for sharing!

  2. steve says:

    This is just great – thx!

  3. Chris Enloe says:

    Great for someone who isn’t the fast typer….Downloading now!

  4. Adam says:

    This is awesome, because

    A) I hate writing markup
    B) I hate writing markup.

    So this will make my life 20x easier :)

  5. I love these snippets and shortcut programs. Thanks Jeff!rey!

  6. Jeffrey Way says:
    Author

    It would be cool if there was a way to designate in the selector that you want to paste in some generic lorem text….

    Like:

    div#header>p>@lorem

  7. Mike Henderson says:

    Works nice for html4, but when evaluating html5 elements they don’t auto indent.

    Is there a simple fix?

  8. Erik says:

    Holy cow and horse.

    That is really useful and awesome!

  9. CMT says:

    Thanks a lot by the tip Jeff!

    I’ve just bought Coda, exactly 5 minutes ago and now with Zen + Coda Clips I think I’ll code 10x faster :-)

  10. Micko says:

    Looks really awesome.

  11. Dude you speek faster than a machine gun ;). Nevertheless, very cool way to increase your coding-speed.

  12. pilola says:

    What I think of this? Freakin awesome is what I think of it.
    Going to get it right away!

  13. Hey folks,

    a quick Q&A about Zen Coding:

    It would be cool if there was a way to designate in the selector that you want to paste in some generic lorem text

    There are two types of entities in Zen Coding: elements and snippets. Elements describes XHTML tag, their default attributes and values. Snippets are an arbitrary pieces of code. So, in your case you have to create a new snippet. After installing, go to ~/Library/Application Support/Coda/Plug-ins, right-click on TEA for Coda.codaplugin and choose Show Package Contents. Open up Support/Library/zencoding/zen_settings.py file. It’s a simple, JSON-like definition of all ZC elements and snippets. Find ‘snippets’ under ‘html’ section and define a new snippet, like this:

    'lorem': 'Lorem ipsum dolor sit amet...'

    Now you can use it as p>lorem

    Works nice for html4, but when evaluating html5 elements they don’t auto indent.

    ZC still don’t know about HTML5 elements (my bad), but you can easily fix it. Open zen_settings.py (see above), find ‘element_types’ section and write down comma separated list of HTML5 tags for ‘block_level’ elements.

    Hope you guys love Zen Coding!

  14. Bram Jetten says:

    I am so thrilled about this. It’s unimaginable how such a tiny plugin can speed up your process this good!

    Using it together with Coda and loving it!

  15. Kwaa says:

    Quite frankly I never use text expanders or apps like that. I have it all in coda.
    But this is just pure brilliance.

    Thumps up! More of these.

  16. Jamie Chung says:

    It will take some time to get used to but I think it make things faster and easier for me in the long run. Good find!

  17. Danilo says:

    This is great for speeding the process of writing tedious repetitive code, I just wish they support notepad++

  18. Jay says:

    Wow, that’s really nice! I hate writing menus

    Would love to see more Dreamweaver support :D (it actually works with CS3)

  19. slier says:

    Awesome stuff

  20. WallMountedHDD says:

    Am I the only one who doesn’t consider XHTML/CSS real coding? Back in the 90s I used to call it “tagging.”

  21. Ahmad Alfy says:

    wow that’s great! It’s gonna help!
    Best thing it support all those IDEs
    I tested it with Dreamweaver and it works like a charm

  22. eldian says:

    Awesome stuff!!!!!!!!!

    Anyone here using this with TopStyle?

    Question for Sergey or anyone else using TopStyle. Right now after writing out the code I have to highlight everything and then press the Zen HTML button. Was wondering if there was a shortcut or is there another way besides highlighting the code and then pressing the Zen HTML button?

    • I’m not the author of TopStyle plugin. Looks like there are limitations in TopStyle API that prevents from getting current line and cursor position. So you have to select abbreviation before expanding.

  23. jermaine says:

    nice this is much better than my text expander

  24. Saw a screencast about it few months ago on smashingmagazine but didn’t really understand how to use it, and in this little screencast of yours it became all much more clear :) Thanks Jeffrey.

  25. Mark Osborne says:

    Looks great! I’ll give it a bash in Apatana when I get a mo. Although, for me I think coding HTML is probably what takes up the least amount of time. What would be great is if you could have this also generate CSS classes ready for styling as well and save a few more steps. I find it really frustrating after laying out all my elements that I have to then go into a CSS file and recreate all those tags again.

    • Chris Simpson says:

      code your sites in a consistant and semantic way, then have some default stylesheets ready to attatch, then problem solved :)

  26. Ive been tinkering with this all night. VERY NICE. I have been thinking about getting a text extender for dreamweaver. I have used Coda in the past and fell in love but do not personally own a Mac so this should bring some at least one of my favorite features from Coda :)

    another tip, you can open/close any tag you want (wether it’s really a tag or not)

    just type like:
    blah control+,

    and you will get:

    im especially liking the document presets “html:5″ ftw!

  27. David Moreen says:

    I’ve actually came a long way ever since I began writing HTML, I’m pretty fast. But I know how to write it, I don’t need to keep doing it over and over for each design I do…

    Not only will this allow me to write code faster but I will be able to focus my time on more important aspects of a design. Thanks Jeff!

  28. Vin Thomas says:

    Jeffery,

    Very cool! But I don’t know if I would really use this. I don’t spend that much time typing out all this stuff anyway. With your screencast on Text-Expander I have become used to using those shortcuts to work almost as fast.

    Thanks for this tutorial.

  29. Rudolf says:

    Brilliant! Thanx!

  30. Arvi says:

    One word DAMN.

  31. krike says:

    The itunes downloadable version is it just to download or is it for ipod or iphone?

    On my ipod I search for nettuts in the podcast, I download the latest podcast which is free, it then downloads and when I want to play the video it says “this movie format is not supported”

    I downloaded another podcast from “jquery for designers” and it will play the video.

    just thought I would ask it.

  32. Eugene says:

    I think it is very convenient, but the amount of supported editors under Windows is much smaller rather, than under Mac. And not everyone got them. So if it will develop, maybe for example for phpDesigner 7 or so, then great.

    • SolidSquid says:

      Sorry if I’m misunderstanding, but there are quite a few editors on windows which are supported. Aptana, TopStyle, Dreamweaver, SlickEdit, Sublime and UltraEdit all support windows as well as other platforms. If you want to try one of them then Aptana is free to download/use

  33. Paul du Long says:

    Looks awesome ….. unfortunally no Notepad++ support :’(

  34. Rick Bross says:

    How, with this plus Texter im going to be unstooppable, thanks Drew.

  35. BCProducties says:

    One word: awesome! :D

  36. I sounds great but I can’t really find a use for it, Visual Studio and Dreamweaver already help me out when writing markup. What would be nice is if they make it for Notepad++, especially if they included a feature to automatically write doctype + basic page layout.

  37. jlapitan says:

    this is great! but it does not support notepad++ :(

  38. Yusuf says:

    really awesome. works great with dw

  39. Felix says:

    Thats coo

    I got a question for you Jeffrey, in one of your other screencasts you said, “we can all agree that TextMate is much better than Coda”, and now u say that Coda is a fantastic editor well worth the money. I tried to Code a webiste in Coda and TextMate, I like them both but is Coda really worth the 50 extra $?

    thanks.

    • Jeffrey Way says:
      Author

      Are you sure I said that? That doesn’t sound like me. I might have said that I generally prefer TextMate….but Coda is fantastic as well. I use both often.

      • Felix says:

        you do in:
        Ask JW: Working on your server in TextMate

        but anyways what i really miss in textmate is that i doesnt auto-complete ur tags. Coda automaticly finishes a with , is there any option for this in textmate?

  40. Dave says:

    Why is there php code in the post’s thumbnail?
    I will definitely use Zen Coding in Visual Studio Ultimate 2010!

  41. Thanks !

    That’s really usefull !

    Great !

  42. Marie Kyle says:

    this is amazing, omg. thank you!

  43. Dumm says:

    good tutorial. regards.

  44. IgnacioRV says:

    Thanks for the informative screencast, this kind of tools really help to improve performance (and in a very cool way indeed :) )

  45. Siriquelle says:

    I like it, hope i find a project soon that i can use it in. Looks like it would remove some of the tediousness of repetitive coding and leave more time for design.

  46. Stanislas says:

    Really great job Sergey. I’d like to add my support for Notepad++ support as well, thank you so much!

  47. Shiro says:

    will it support Elipse PDT IDE?

  48. Ben says:

    I hate those kind of things, so impractical.

Comment Page 1 of 21 2

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.