Skip to main content

Quick layouts with Zen Coding in HTML



Zen coding is something amazing which is used to develop a layout just in some seconds. It allows us to rapidly create our Mark Up .We can use this feature by installing a plug in for our editor.

You can also see some tricks of using Zen Coding in “code.google.com/zen-coding “


Let us see how we can use Zen Coding:

1] If you want to create an element you just need to type the element name and press trigger It will generate the opening and closing tags.

Eg .

Just type

[box type="shadow" ]ul[/box]

And press the trigger

You will have the generated code as following:

[box type="shadow" ]
<ul> </ul>

[/box]

2] When you enter the following code :

[box type="shadow" ]

.example

[/box]

It will generate a div with class name emaple.

[box type="shadow" ]
 <div class="example"></div>

[/box]

3] You can give id to div tags using  # sign

[box type="shadow" ]#someid [/box]

Will give

[box type="shadow" ]
<div id="someid"></div>

[/box]

4] To generate nested tags  &lt sign is used

[box type="shadow" ]ul>li[/box]

will generate

[box type="shadow" ]

<ul>

<li></li>

</ul>

[/box]

5] The sign * indicates number of the elements to be generated

[box type="shadow" ]ul > li * 5  [/box]

will generate

[box type="shadow" ]

<ul>

<li></li>

<li></li>

<li></li>

<li></li>

<li></li>

</ul>

[/box]

6] Curly braces are used to indicate the content of particular tag

Eg.

[box type="shadow" ].wrap Header> h1 { My header } [/box]

Will generate the following code :

[box type="shadow" ]
<div class= ”wrap”>
 <header> 
  <h1>
   My header
  </h1>
 </header>
</div>

[/box]

7] To generate a sibling for any tag you can use + sign

Eg.

[box type="shadow" ].wrap Header> h1 { My header } + nav> ul> li*5[/box]

Will generate following code

[box type="shadow" ]
<div class= ”wrap”>
 <header>
  <h1>
   My header
  </h1>
 </header>
 <nav>
  <ul>
   <li> </li>
   <li> </li>
   <li> </li>
   <li> </li>
   <li> </li>
                </ul>
 </nav>
        
</div>

[/box]

8] You also can initialize any property of any element with square braces

Eg . let us initialize anchor tag with the attribute href = “#”

[box type="shadow" ].wrap Header> h1 { My header } + nav > ul > li*5> a [ href=”#”][/box]

Will generate :

[box type="shadow" ]
<div class= ”wrap”>
 <header> 
  <h1>
   My header
  </h1>
 </header>
 <nav>
  <ul> 
   <li> <a href=”#”> </a> </li>

                        <li> <a href=”#”> </a> </li>

                        <li> <a href=”#”> </a> </li>

                        <li> <a href=”#”> </a> </li>

   <li> <a href=”#”> </a> </li>

                </ul>
       </nav> 
</div>

[/box]

9] You can navigate on tags after generation of actuall code by pressing trigger

In sublime text the key “Tab” where as in notepad ++  “ctrl + E” works as the Trigger .

Enjoy quick layouts using Zen Coding in any editor.





Comments

  1. How do I use 'Zen Coding'? You don't seem to mention it in this article.

    ReplyDelete
  2. Just what exactly honestly influenced u to write “Quick layouts with Zen Coding in HTML | TexoidTexoid”?
    Iabsolutely enjoyed the blog post! Thanks a lot -Basil

    ReplyDelete

Post a Comment

Popular posts from this blog

Facebook Login In PHP

As we all know Time is Money. When there's a long form on your site for registration you could sometimes lose your visitors. To make this registration step a success, adding a small social login button to your site may cut down lot of burden on visitors side and will help you in getting more attention on your data rather than wasting time on the lengthy registration process. By doing so visitor will be glad to see that you care for their precious time.   What do you think will there be anyone in this small world who is not having a Facebook account? According to recent stats 1 in every 13 person in this world is using facebook.

USB Boot Procedure

Simple step-by-step solution to create a bootable usb in cmd: 1)   Take a pen drive of more than 4gb . 2)   Now the most important step is to open cmd from start->search program and files->type cmd . 3)   Now in the new window, type diskpart and hit enter. 4)   Type the command list disk . Now, note the disk which have size identical to that of your pen drive. eg. disk 1. 5)   Type the command select disk 1 . 6)   Then type clean and hit enter. 7)   Just type create partition primary and press enter. 8)  Then run the command list partition . 9)  Type select partition 1 and hit enter. 10) Format it using the command format fs=ntfs . 11) Type the commands active , assign and exit in sequence. Now just copy all the files from Boot-able disc of  windows 7 to the pen drive and your pen drive is ready to be used as a boot-able device.