Skip to main content

Command Palette

Search for a command to run...

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

Published
3 min read
Emmet for HTML: A Beginner’s Guide to Writing Faster Markup

Writing HTML feels slow at first (and that’s normal)

When you start writing HTML, it often looks like this:

<div class="card">
  <h1>Title</h1>
  <p>Description</p>
</div>

Now imagine writing this again and again, closing every tag manually, fixing indentation, and adding classes carefully.

It works.
But it feels slow.

This is exactly the problem Emmet solves.

What is Emmet?

Emmet is a shortcut language for writing HTML faster.

You write a short abbreviation, press a key (usually Tab or Enter), and Emmet expands it into full HTML.

Think of it as:

autocomplete on steroids for HTML

You describe the structure you want, not every character.

Why Emmet is useful for HTML beginners

Emmet helps beginners because it:

  • reduces typing

  • avoids syntax mistakes

  • reinforces correct HTML structure

  • keeps you focused on layout, not keystrokes

You learn how HTML is structured while writing it faster.

And the best part:

Emmet is optional, but once you use it, you never go back.

How Emmet works inside code editors

Emmet is built into most modern editors.
No setup needed.

Most popular:

  • VS Code

  • WebStorm

  • Sublime Text

Basic workflow:

  1. Type an Emmet abbreviation

  2. Press Tab or Enter

  3. HTML appears

Your first Emmet example

Emmet

p

Press Tab.

Result

<p></p>

That’s it.
You just created an HTML element instantly.

Creating HTML elements using Emmet

You can create any tag by typing its name.

Examples

EmmetExpands to
div<div></div>
h1<h1></h1>
span<span></span>

This alone saves a lot of typing.

Adding classes using Emmet

Use a dot . to add a class.

Emmet

div.card

Result

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

Multiple classes:

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

Adding IDs using Emmet

Use # to add an ID.

Emmet

div#header

Result

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

Class + ID together:

div#header.container
<div id="header" class="container"></div>

Adding attributes using Emmet

Use square brackets [].

Emmet

img[src="image.png" alt="profile"]

Result

<img src="image.png" alt="profile">

This is extremely useful for:

  • images

  • links

  • inputs

Creating nested elements

Use > to create nesting.

Emmet

div.card>h1+p

Result

<div class="card">
  <h1></h1>
  <p></p>
</div>

You just described structure, not syntax.

Repeating elements using multiplication

Use * to repeat elements.

Emmet

li*3

Result

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

Combine with nesting:

ul>li*3
<ul>
  <li></li>
  <li></li>
  <li></li>
</ul>

This is perfect for:

  • lists

  • cards

  • grids

Text inside elements

Use curly braces {}.

Emmet

p{Hello World}

Result

<p>Hello World</p>

Combine everything:

ul>li*3{Item}
<ul>
  <li>Item</li>
  <li>Item</li>
  <li>Item</li>
</ul>

Generating full HTML boilerplate

One of the most loved Emmet features.

Emmet

!

or

html:5

Result

<!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>

Is Emmet mandatory?

No.

You can write HTML without Emmet forever.

But Emmet:

  • saves time

  • reduces mistakes

  • improves flow

  • makes learning fun

That makes it worth learning.