What Is Emmet?
Emmet is a toolkit that expands short abbreviations into complete HTML or CSS code, allowing developers to write markup faster and with fewer errors.
Why Use Emmet?
- Reduces repetitive typing, decreasing fatigue and frustration.
- Accelerates prototyping and experimentation with instant layout generation.
- Reinforces proper markup structure through consistent patterns.
- Works across most popular code editors via built‑in support or plugins.
How Emmet Works Inside a Code Editor
When an abbreviation is typed in a file recognized as HTML or CSS, pressing Tab (or the editor’s suggestion shortcut) expands it to the full markup.
- Ensure the file has the correct extension (.html, .css, .js, etc.).
- Type the abbreviation on its own line without surrounding characters.
- If
Tabdoes not expand, trigger the suggestion list withCtrl+Spaceand pressEnter.
Basic Emmet Syntax
Emmet uses a small set of symbols to describe relationships between elements.
>– Child relationship (parent>child).+– Sibling relationship (element+element).*– Multiplication (element*3 creates three copies).#– ID attribute (div#header)..– Class attribute (ul.nav).{}– Text content (p{Hello World}).
Creating Simple HTML Elements
Type the tag name and press Tab to generate opening and closing tags.
- Example:
p→<p></p>
Creating Nested Elements
Use the child operator (>) to nest tags.
- Example:
ul>li*3expands to a list with three<li>items.
Repeating Elements with Multiplication
The multiplication operator (*) repeats an element a specified number of times.
- Example:
div.box*4creates four<div class="box">elements.
Generating a Full HTML Boilerplate
The single exclamation mark shortcut creates a complete HTML5 document structure.
- Type
!and pressTabto produce the boilerplate.