HomeProjectsBlogResume
Sharanayya
ProjectsBlogVideosResume
All articles
  • HTML
  • Emmet
  • VS Code
  • Web Development
  • Productivity

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

Learn Emmet, the shortcut language that turns cryptic abbreviations into full HTML in seconds. Master basic syntax, nesting, multiplication, and boost your HTML productivity by 10x.

January 27, 20259 min read
Share
Emmet for HTML: A Beginner's Guide to Writing Faster Markup
  • What is Emmet?
  • Before Emmet (The Slow Way)
  • With Emmet (The Fast Way)
  • Why Emmet is Perfect for Beginners
  • How Emmet Works in Code Editors
  • The Basic Workflow
  • Basic Emmet Syntax
  • Creating Elements
  • Adding Classes and IDs
  • Adding Classes (.)
  • Adding IDs (#)
  • Combining Classes and IDs
  • Adding Custom Attributes
  • Multiple Attributes
  • Common Patterns
  • Creating Nested Elements
  • Deeper Nesting
  • Repeating Elements with Multiplication
  • Combined with Nesting
  • Real-World Example: Navigation
  • Adding Text Content
  • Combined with Other Features
  • Numbered Text with $
  • Sibling Elements
  • Combined with Nesting
  • Grouping with Parentheses
  • The HTML Boilerplate Shortcut
  • Emmet Cheat Sheet
  • Real-World Examples
  • Card Component
  • Form with Inputs
  • Footer with Links
  • Tips for Learning Emmet
  • Common Mistakes to Avoid
  • Emmet is Optional, But Powerful
  • Summary
  • Conclusion

Have you ever felt like writing HTML is... tedious? Opening tags, closing tags, indentation, classes, IDs – it's repetitive and time-consuming.

What if I told you there's a way to write HTML 10x faster?

Enter Emmet – a developer's secret weapon for writing markup at lightning speed.


What is Emmet?

In the simplest terms, Emmet is a shortcut language for HTML and CSS. You type a short abbreviation, press Tab, and it expands into full, properly formatted code.

Think of it like texting

Just as "brb" expands to "be right back" in your mind, Emmet expands div.container into <div class="container"></div> in your editor.

Before Emmet (The Slow Way)

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

Time: 15-20 seconds of typing

With Emmet (The Fast Way)

div.container>ul>li*3

Press Tab and... done!

Time: 2 seconds


Why Emmet is Perfect for Beginners

You might think: "I'm still learning HTML, why add more syntax?"

Here's why Emmet actually helps beginners:

BenefitExplanation
Fewer typosNo more forgetting closing tags
Correct structureNesting is always right
Muscle memoryReinforces HTML element names
Focus on layoutThink in structure, not syntax
Industry standardEvery pro developer uses it
Tip

Emmet doesn't replace learning HTML – it accelerates it. You still need to understand what <div>, <ul>, and <li> mean. Emmet just types them faster.


How Emmet Works in Code Editors

Emmet is built into most modern code editors:

  • ✅ VS Code – works out of the box
  • ✅ WebStorm – built-in
  • ✅ Sublime Text – plugin available
  • ✅ Atom – plugin available

Emmet workflow in VS Code showing type, tab, expandEmmet workflow in VS Code showing type, tab, expand

The Basic Workflow

  1. Type an Emmet abbreviation
  2. Press Tab (or Enter in the autocomplete menu)
  3. Watch it expand into HTML

That's it. No configuration needed in VS Code!


Basic Emmet Syntax

Let's learn Emmet one concept at a time. Try each example yourself!

Creating Elements

Just type the element name:

AbbreviationExpands To
div<div></div>
p<p></p>
span<span></span>
header<header></header>
nav<nav></nav>
section<section></section>
Emmet: header
Result: <header></header>
Info

Emmet knows all HTML5 elements. Just type the tag name!


Watch one abbreviation unfold into real markup:

Expanding an abbreviationEXPANDING AN ABBREVIATIONul>li.item*3 becomes nine linesexpanded HTML<ul> <li class="item"></li> <li class="item"></li> <li class="item"></li></ul>
1/5
Step 1. You type `ul>li.item*3` and press Tab. Emmet reads it as a tree, not as text.

Adding Classes and IDs

This is where Emmet starts to shine.

Adding Classes (.)

Use a dot followed by the class name:

Emmet: div.container
<div class="container"></div>

Multiple classes? Just chain them:

Emmet: div.container.flex.items-center
<div class="container flex items-center"></div>

Adding IDs (#)

Use a hash followed by the ID:

Emmet: section#hero
<section id="hero"></section>

Combining Classes and IDs

Emmet: div#main.container.wrapper
<div id="main" class="container wrapper"></div>

Adding Custom Attributes

Use square brackets for custom attributes:

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

Multiple Attributes

Emmet: input[type="email" placeholder="Enter email" required]
<input type="email" placeholder="Enter email" required>

Common Patterns

AbbreviationResult
a[href="#"]<a href="#"></a>
img[src="" alt=""]<img src="" alt="">
button[type="submit"]<button type="submit"></button>
input[type="text"]<input type="text">

Creating Nested Elements

Use the greater-than sign (>) to create children:

Emmet: div>p
<div>
  <p></p>
</div>

Deeper Nesting

Emmet: nav>ul>li>a
<nav>
  <ul>
    <li>
      <a href=""></a>
    </li>
  </ul>
</nav>

Nested HTML structure generated by Emmet showing nav, ul, li hierarchyNested HTML structure generated by Emmet showing nav, ul, li hierarchy

Read it like a path

nav>ul>li>a reads as: "nav contains ul, which contains li, which contains a"


Repeating Elements with Multiplication

Use the asterisk (*) to repeat elements:

Emmet: li*5
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>

Emmet multiplication feature showing li*5 creating 5 elementsEmmet multiplication feature showing li*5 creating 5 elements

Combined with Nesting

Emmet: ul>li*3
<ul>
  <li></li>
  <li></li>
  <li></li>
</ul>

Real-World Example: Navigation

Emmet: nav>ul.nav-list>li.nav-item*5>a.nav-link
<nav>
  <ul class="nav-list">
    <li class="nav-item"><a href="" class="nav-link"></a></li>
    <li class="nav-item"><a href="" class="nav-link"></a></li>
    <li class="nav-item"><a href="" class="nav-link"></a></li>
    <li class="nav-item"><a href="" class="nav-link"></a></li>
    <li class="nav-item"><a href="" class="nav-link"></a></li>
  </ul>
</nav>

That's a full navigation structure in one line!


Adding Text Content

Use curly braces to add text inside elements:

Emmet: p{Hello World}
<p>Hello World</p>

Combined with Other Features

Emmet: a[href="#"]{Click Me}
<a href="#">Click Me</a>

Numbered Text with $

Use $ for auto-incrementing numbers:

Emmet: ul>li{Item $}*3
<ul>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ul>
Tip

Use $$ for zero-padded numbers: Item 01, Item 02, etc.


Sibling Elements

Use the plus sign (+) to create siblings (elements at the same level):

Emmet: header+main+footer
<header></header>
<main></main>
<footer></footer>

Combined with Nesting

Emmet: div>(header>nav)+main+footer
<div>
  <header>
    <nav></nav>
  </header>
  <main></main>
  <footer></footer>
</div>

Grouping with Parentheses

Use parentheses to group elements:

Emmet: div>(header>h1)+section+footer
<div>
  <header>
    <h1></h1>
  </header>
  <section></section>
  <footer></footer>
</div>

This is powerful for complex layouts!


The HTML Boilerplate Shortcut

This is the most magical Emmet abbreviation. Just type:

!

Press Tab and get a complete HTML5 boilerplate:

<!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>
Make sure you're in an HTML file

The ! shortcut only works in files with .html extension or files recognized as HTML by your editor.


Emmet Cheat Sheet

Here's a quick reference of everything we've learned:

SyntaxPurposeExample
elementCreate elementdiv → <div></div>
.classAdd classdiv.box → <div class="box">
#idAdd IDdiv#main → <div id="main">
[attr]Add attributea[href="#"] → <a href="#">
>Child elementul>li → nested
+Sibling elementh1+p → side by side
*nMultiplyli*5 → 5 list items
{}Add textp{Hello} → <p>Hello</p>
$Numberingli{Item $}*3 → Item 1, 2, 3
()Grouping(div>p)*2 → grouped
!HTML boilerplateFull HTML5 template

Real-World Examples

Let's build some common UI patterns using Emmet:

Card Component

Emmet: article.card>img.card-image+div.card-body>(h3.card-title{Card Title}+p.card-text{Description here}+a.btn{Read More})

Form with Inputs

Emmet: form.contact-form>div.form-group*3>label+input[type="text"]+button[type="submit"]{Submit}

Footer with Links

Emmet: footer.site-footer>div.container>div.row>(div.col>h4{Company}+ul>li*4>a{Link $})+(div.col>h4{Resources}+ul>li*3>a{Resource $})

Tips for Learning Emmet

Practice Makes Perfect
  1. Start simple – Master elements and classes first
  2. Use it daily – Force yourself to use Emmet instead of typing HTML
  3. Build muscle memory – Common patterns like div.container> become automatic
  4. Experiment – Try weird combinations to see what happens
  5. Don't memorize everything – Learn the concepts, reference the syntax

Common Mistakes to Avoid

❌ Wrong✅ Correct
div .class (space)div.class (no space)
div>li*3 (wrong parent)ul>li*3 (correct)
Forgetting TabAlways press Tab to expand

Emmet is Optional, But Powerful

Remember: you don't have to use Emmet. You can write HTML the traditional way forever.

But once you experience the speed boost, there's no going back. Professional developers use Emmet because:

  • It's faster (10x or more)
  • It reduces errors
  • It keeps you in flow state
  • It's industry standard

Summary

ConceptKey SymbolExample
Elements(none)div, p, span
Classes.div.container
IDs#div#main
Attributes[]a[href="#"]
Nesting>ul>li
Siblings+h1+p
Multiplication*li*5
Text{}p{Hello}
Numbering$li{Item $}*3
Grouping()(div>p)*2
Boilerplate!Full HTML5

Conclusion

Emmet transforms HTML writing from a typing exercise into a thinking exercise. Instead of worrying about syntax, you focus on structure.

Start with the basics:

  1. Element names (div, p, span)
  2. Classes and IDs (.class, #id)
  3. Nesting (>) and multiplication (*)
  4. The boilerplate shortcut (!)

Within a week of practice, you'll wonder how you ever wrote HTML without it.

Now open VS Code and start practicing! 🚀


Have questions about Emmet? Drop a comment or reach out on Twitter @srtenginamath!

Sharanayya R Tenginamath

Written by Sharanayya R Tenginamath

Software Engineer at McD BERL with 4+ years building scalable full-stack applications with React.js, Next.js, TypeScript, FastAPI and Python. Available to join from Oct 12, 2026.

View resumeGet in touchFollow on X
  • What is Emmet?
  • Before Emmet (The Slow Way)
  • With Emmet (The Fast Way)
  • Why Emmet is Perfect for Beginners
  • How Emmet Works in Code Editors
  • The Basic Workflow
  • Basic Emmet Syntax
  • Creating Elements
  • Adding Classes and IDs
  • Adding Classes (.)
  • Adding IDs (#)
  • Combining Classes and IDs
  • Adding Custom Attributes
  • Multiple Attributes
  • Common Patterns
  • Creating Nested Elements
  • Deeper Nesting
  • Repeating Elements with Multiplication
  • Combined with Nesting
  • Real-World Example: Navigation
  • Adding Text Content
  • Combined with Other Features
  • Numbered Text with $
  • Sibling Elements
  • Combined with Nesting
  • Grouping with Parentheses
  • The HTML Boilerplate Shortcut
  • Emmet Cheat Sheet
  • Real-World Examples
  • Card Component
  • Form with Inputs
  • Footer with Links
  • Tips for Learning Emmet
  • Common Mistakes to Avoid
  • Emmet is Optional, But Powerful
  • Summary
  • Conclusion

Related articles

  • CSS
  • Web Development

CSS Selectors 101: Targeting Elements with Precision

Master CSS selectors from basics to advanced. Learn element, class, ID, group, and descendant selectors with practical examples. Build a solid foundation for styling web pages.

Jan 27, 2025·11 min read

  • Web Development
  • Browser

How a Browser Works: A Beginner-Friendly Guide to Browser Internals

Learn how browsers transform a URL into pixels on your screen. Understand DOM, CSSOM, rendering engines, and the complete journey from pressing Enter to seeing a webpage.

Jan 27, 2025·10 min read

  • HTML
  • Web Development

Understanding HTML Tags and Elements: A Complete Beginner's Guide

Learn the fundamentals of HTML tags and elements. Understand opening tags, closing tags, void elements, block vs inline elements, and commonly used HTML tags with practical examples.

Jan 27, 2025·10 min read

Still reading? Let's talk.

I'm serving my notice period and can join from Oct 12, 2026, open to full-time Software Engineer, Full-Stack and GenAI roles. The fastest way to reach me is a quick call or an email.

Book a call
  • GitHub
  • LinkedIn
  • X
  • YouTube
  • RSS

© 2026 Sharanayya R Tenginamath · Tech Swamy Kannada. Built with Next.js.

HomeProjectsBlogResume