let’s say you need to write down the following HTML code:
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6"></div>
</div>
Using Emmet you would type the following:
div.row>div.col-md-6*2
And then dramatically press the TAB key on your keyboard, it will expand to the aforementioned html like magic.
1 : Almost nothing,online web editors like my favorite at the moment Codepen you already use it: emmet in codepen. The html & css sections support Emmet,all you need to do is learn the syntax, but what about your local environment ?
2 : Depending on your Development Environment or Text Editor, you will have to download a plugin, here is a list of supported editors: Emmet.io for your editor
To get this:
<div>
</div>
You would type this:
div
To get this:
<div>
<div>
<div></div>
</div>
</div>
You would type this:
div>div>div
To get this:
<div class="classy1 classy2" id="peter"></div>
You would type this:
div.classy1.classy2#peter
To get this:
<div></div>
<div></div>
<div></div>
You would type this:
div+div+div
To get this:
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
You would type this:
ul>li*5
Here’s a handy pen with a few more commands for you to practice your new found Emmet powers at your pace:
See the Pen Emmet Practice Dojo by Eugenio - Keno - Leon (@k3no) on CodePen.
Hope you’ve enjoyed and learned a bit with this quick overview of Emmet.
Till next time.
Best,
Keno