Skip to main content

Command Palette

Search for a command to run...

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

Published
4 min read

What is Emmet? (in very simple terms)

Emmet is a shortcut tool for writing HTML faster.

It lets you:

  • type small shortcuts

  • press Tab

  • and generate full HTML automatically

Think of it like:

  • Text messages → abbreviations (brb, lol)

  • Coding → Emmet shortcuts

Instead of writing:

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

You type:

ul>li*3

Press Tab

And Emmet writes everything for you.


Why Emmet is useful for HTML beginners

When learning HTML, beginners struggle with:

  • Too much typing

  • Repetitive code

  • Forgetting tags

  • Wasting time on structure instead of learning concepts

Emmet helps by:

  • saving time

  • reducing typing

  • preventing mistakes

  • focusing on structure

  • making you faster like a pro

Real benefit:

Instead of spending 5 minutes typing structure, you spend 5 seconds.


How Emmet works inside code editors

Most modern editors already support Emmet:

  • VS Code

  • WebStorm

  • Sublime Text

  • Atom

You don’t install anything (usually).


How it works

  1. Type an abbreviation

  2. Press Tab (or Enter)

  3. Emmet expands it into full HTML


Example

Type:

p

Press Tab →

<p></p>

Basic Emmet Syntax and Abbreviations

Emmet uses symbols to describe structure.

Think of it like a small language.

Here are the most important ones:

SymbolMeaning
>inside (child)
+sibling
*repeat
.class
#id
{}text

You only need these to do 90% of work.


Creating HTML elements using Emmet

Basic element

Type:

div

Output:

<div></div>

Multiple elements

Type:

h1+p

Output:

<h1></h1>
<p></p>

+ means "next to each other"


Adding classes, IDs, and attributes

This is where Emmet shines.

Class

Type:

div.container

Output:

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

ID

Type:

div#header

Output:

<div id="header"></div>

Both together

Type:

div.card.highlight

Output:

<div class="card highlight"></div>

Attributes

Type:

input[type=text]

Output:

<input type="text">

Real example

Type:

a[href=https://google.com]

Output:

<a href="https://google.com"></a>

Creating nested elements

Nesting means elements inside elements.

Emmet uses:

>

which means: “inside”


Example

Type:

div>p

Output:

<div>
  <p></p>
</div>

More nesting

Type:

div>ul>li

Output:

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

It builds the structure automatically.


Tree analogy

Think of:

div>ul>li

Like:

div
 └── ul
      └── li

Like a family tree.


Repeating elements using multiplication

Sometimes you need many similar elements.

Instead of copy-paste…

Use:

*

Example

Type:

li*5

Output:

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

Combined example

Type:

ul>li*3

Output:

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

Super useful for lists, cards, menus.


Adding text inside elements

Use:

{}

Example

Type:

h1{Hello World}

Output:

<h1>Hello World</h1>

Multiple text items

Type:

ul>li{Item}*3

Output:

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

Combining everything (real-world example)

Let’s say you want:

  • a container

  • inside it 3 cards

  • each card has heading + paragraph


Instead of writing manually…

Type:

div.container>div.card*3>h3{Title}+p{Description}

Press Tab →

<div class="container">
  <div class="card">
    <h3>Title</h3>
    <p>Description</p>
  </div>
  <div class="card">
    <h3>Title</h3>
    <p>Description</p>
  </div>
  <div class="card">
    <h3>Title</h3>
    <p>Description</p>
  </div>
</div>

In 2 seconds only.


Generating full HTML boilerplate

This is every beginner’s favorite.


Type:

!

Press Tab


Output:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>

</body>
</html>

Whole HTML template instantly.


Best practices for beginners

Do:

  • Practice small shortcuts daily

  • Use Emmet for repetitive structures

  • Learn symbols (> + * . #)

Don’t:

  • Depend blindly

  • Forget actual HTML structure

  • Skip learning fundamentals

Remember: Emmet speeds up typing, not understanding


Emmet turns HTML from slow typing into rapid building. Once you start using it, writing markup feels less like typing code and more like sketching structure.