Skip to main content

Command Palette

Search for a command to run...

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

Code HTML 10x Faster with Essential Abbreviations

Published
3 min read

What Emmet Is?

Writing HTML without Emmet feels slow and repetitive because you must type every opening and closing tag, repeat tags again and again. So this can be error prone, time-consuming, and repetitive.

<div class="header">
    <nav>
        <ul>
            <li><a href="">Home</a></li>
            <li><a href="">About</a></li>
            <li><a href="">Contact</a></li>
        </ul>
    </nav>
</div>

Emmet:

It is a shortcut language for writing HTML and CSS faster. It allows you to write abbreviation that represent structure, not raw code.

div.header>nav>ul>li*3>a{Item $}

Why Emmet is useful for HTML beginners?

For beginners, writing raw HTML code for even small layouts can be confusing and lead to errors. However, with Emmet, it reduces mistakes and repetition, allowing them to focus more on the logic.

Speeds Up Workflow: Common tasks, such as generating the basic HTML boilerplate (!) Ex:

!(Type this for boiler plate)
<!-- Boiler Plate -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

</body>
</html>

How Emmet works inside code editors ?

Emmet is just a smart text parser and generator Inside the editor (VS Code etc.), Emmet is basically doing three steps:

  1. Emmet reads the abbreviation and break into parts.

  2. After breaking into parts it create an internal structure (tree) to understand parent–child relation.

  3. Now Emmet converts that structure into real HTML code.

  4. Finally, the editor pastes the generated HTML at your cursor position.

    Basic Emmet syntax and abbreviations

SymbolMeaningExampleOutput
>Child (inside element)div>p<div><p></p></div>
+Sibling (same level)h1+p<h1></h1><p></p>
*Repeat elementsli*3<li></li><li></li><li></li>
.Classdiv.card<div class="card"></div>
#IDsection#hero<section id="hero"></section>
{}Text contentbutton{Click}<button>Click</button>
[]Attributesa[href="#"]<a href="#"></a>
!HTML boilerplate!Full HTML structure

Creating HTML elements using Emmet

AbbreviationExpanded HTML
div<div></div>
p<p></p>
a<a href=""></a>
img<img src="" alt="">

Creating nested elements

To create nested elements using Emmet, you primarily use the child operator (>) in your abbreviation.

div#app>header>nav>ul>li.item$*4>a{Menu $}+main>section>article>h2{Title}+p{This is content}+footer>p{© 2026 MySite}
<div id="app">
  <header>
    <nav>
      <ul>
        <li class="item1"><a href="">Menu 1</a></li>
        <li class="item2"><a href="">Menu 2</a></li>
        <li class="item3"><a href="">Menu 3</a></li>
        <li class="item4"><a href="">Menu 4</a></li>
      </ul>
    </nav>
  </header>

  <main>
    <section>
      <article>
        <h2>Title</h2>
        <p>This is content</p>
      </article>
    </section>
  </main>

  <footer>
    <p>© 2026 MySite</p>
  </footer>
</div>

Generating full HTML boilerplate with Emmet

Boiler Plate: In HTML boiler plate is basic structure. It can be applied by using (!).

!(Type this for boiler plate)
<!-- Boiler Plate -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

</body>
</html>

Emmet is optional, not required to write HTML, but it is a powerful productivity tool.
It allows developers to write HTML/CSS using short abbreviations that expand into full code, which saves time and reduces repetitive typing.