Skip to main content

Command Palette

Search for a command to run...

Emmet for HTML: A Beginner’s Guide to Writing Faster Markup

Updated
2 min read
Emmet for HTML: A Beginner’s Guide to Writing Faster Markup

Why writing HTML feels slow

Writing HTML like this:

<div>
  <ul>
    <li></li>
    <li></li>
    <li></li>
  </ul>
</div>

…feels repetitive.

Now imagine writing this in one line:

div>ul>li*3

And it expands automatically.

That’s where Emmet comes in.


What is Emmet?

Emmet is a shortcut language for writing HTML.

If you're not familiar with HTML structure yet, understanding tags and elements will help.
HTML for beginners

Instead of typing full code, you write short abbreviations and your editor expands them into HTML.


Why Emmet is useful

  • saves time

  • reduces repetitive typing

  • makes nested HTML easier

  • helps you think in structure


How Emmet works

  1. Type an abbreviation

  2. Press Tab

  3. It expands into HTML

Works in most code editors (VS Code recommended)


Creating HTML elements

p

<p></p>

Adding classes and IDs

div.container

<div class="container"></div>
div#main

<div id="main"></div>

Creating nested elements

ul>li

<ul>
  <li></li>
</ul>

Repeating elements

li*3

<li></li>
<li></li>
<li></li>

Numbering elements

li.item$*3

<li class="item1"></li>
<li class="item2"></li>
<li class="item3"></li>

Full HTML boilerplate

!

→ generates full HTML structure


Key Insight

Emmet is not just about typing faster.

It helps you think in HTML structure.


Try This

Open your code editor

Type:

div>ul>li*5

Press Tab

See what happens.


Final Thought

Emmet is optional.

But once you start using it, you won’t go back to writing HTML manually.

Once you can write HTML faster, the next step is styling it using CSS selectors.
CSS Selectors