Skip to main content

Command Palette

Search for a command to run...

Master Emmet: The Essential Guide to High-Speed Web Development

Stop typing tags and start building logic with the industry’s favorite shorthand tool.

Updated
5 min read
Master Emmet: The Essential Guide to High-Speed Web Development

Imagine building a website with no AI, no internet, and only a basic text editor. Every <div> and <section> has to be typed by hand, a painfully slow, repetitive grind. But developers are masters of efficiency. Where there is a bottleneck, there is a tool.

Enter Emmet, the industry-standard plugin that transforms simple abbreviations into full HTML structures instantly. It’s not just a shortcut; it’s a way to think about your layout in "shorthand" so you can spend less time fighting syntax and more time building features.

What is Emmet?

Emmet is a plugin for text editor, that completes the HTML syntax with just abbreviations. This plugin enables you to write correct syntax without the need to type opening tag, closing tag along with their brackets. The advantage of using this is:

  • Speed

  • Code without syntax errors

  • Think and plan of component layout before you code

Now we know what Emmet is, we can move on to the 10 step guide to code in 10x speed.

The Refined 10-Step Guide

Step 1: Generate HTML Page in One Character

Using Emmet, we can code the entire HTML 5 document with just a single character, without the need to type DOCTYPE, <html>, or <head> tags.

Type ! and hit Tab/Enter.

!

Step 2: Create Elements With Classes

Classes are the backbone of CSS styling. Emmet treats them like CSS selectors.
To use it, write a tag followed by the class name separated with a dot (.).

Syntax: tag_name.class_name

Example:

div.container.card

In the above example, multiple classes are chained with multiple dots. Try implementing button.btn.btn-primary youself.

Step 3: Add Unique IDs

The syntax for ID is similar to classes, but the dot (.) is replaced with a hash (#).

Syntax: tag_name#id_name

Example

nav#main-navigation.menu

The classes and ID are paired together, the ID comes first, followed by the classes.

Step 4: Nesting Elements

Creating "parent-child" relationships is easy with the "greater-than" symbol (>)

Syntax: tag_name>tag_name>

Example:

header>nav>div.menu>ul>li

In a single line, a whole block is created, paired up with a class without the hassel to write everything.

Step 5: Creating Siblings

Siblings are the elements on the same level. Use the plus (+) symbol to place them side-by-side.

Syntax: tag_name+tag_name

Example:

div.card>h2.title+p.description+button.cta

The siblings combined with nesting can speed up the way you make blocks.

Step 6: Multiply Elements

When there is a need to create multiple copies of the same element, asterik (*) symbol is used.

Syntax: tag_name*(number)

Example:

nav>ul>li*5>a

The entire navigation bar is made in a single line of code.

Step 7: Clone Elements with Auto-Numbering

When there is a need to create multiple copies of the same element with numbered orderly, dollar ($) symbol is used to create the numbering.

Syntax: tag_name.class_name$*3
        tag_name#id_name$*3
        tag_name{text_$}*3

Example:

div.card$*3

💡
Use $$ for zero-padded number, and $@- for counting in reverse order.

Try the same with ID, also try zero-padding numbering and make sections in reverse order.

Step 8: Add Text Content

To insert text directly into an element, wrap it in curly braces ({}).

Syntax: tag_name{text}

Example:

ul>li{Step $}*5

Step 9: Add Custom Attributes

For attributes like src, href, or placeholder, use square brackets ([]).

Syntax: tag_name[attribure="value"]

Example:

input[type="email"placeholder="Enter your email"]

Try to make a card form, input and button element as siblings and add custom attributes to them

Step 10: Master Complex Structures with Grouping

When your code gets deep, use parentheses () to group sections. This helps to create complex structure.

Example:

div.card>(img.card-img[src="image.jpg"]+div.card-body>h3.card-title{Card Title}+p.card-text
{Description here}+button.btn{Read More})

💡
You can use carat (^) to move up levels. Use once to move one level up, twice to move two level up and so on.

Replicate the above by the use of ^.


Emmet Cheat Sheet

SymbolWhat It DoesExample
!HTML5 boilerplate! → Full HTML page
.Add classdiv.box<div class="box">
#Add IDdiv#main<div id="main">
\>Child (nest inside)div>p<div><p></p></div>
+Sibling (same level)h1+p<h1></h1><p></p>
*Multiply (repeat)li*3<li></li><li></li><li></li>
$Auto-numbering.item$*3 → .item1 .item2 .item3
{ }Text contentp{Hello}<p>Hello</p>
[ ]Custom attributesa[href="#"]<a href="#"></a>
^Climb updiv>p^span<div><p></p></div><span>
( )Grouping(div>p)*2 → Two div>p groups
loremLorem ipsum textlorem10 → 10 words of text

To find more usage of Emmet look at Emmet Cheat Sheet.


Coding shouldn't feel like a data-entry job. By mastering these 10 Emmet shortcuts, you move from "typing code" to "architecting layouts." What used to take minutes of repetitive keystrokes now takes seconds, leaving you with cleaner code and a much faster workflow. Open your favorite editor (VS Code has Emmet built-in!), try these shortcuts, and watch your productivity skyrocket.