Skip to main content

Command Palette

Search for a command to run...

Emmet: Code Less, Build More

Published
11 min read

Emmet as a shorthand language for web developers. It’s a free plugin—built into most modern code editors like VS Code—that allows you to type abbreviated "CSS-like" snippets and instantly transform them into full blocks of HTML or CSS code.

Guide

1. The Core Syntax Operators

These symbols define the relationship between elements (nesting, siblings, grouping).

SymbolNameFunctionExample InputExpanded Output (Simplified)
>ChildNests elements inside.div>ul>li<div><ul><li></li></ul></div>
+SiblingPlaces elements next to each other.h1+p<h1></h1><p></p>
^Climb UpMoves up one level in the hierarchy.div>p>span^h1<div><p><span></span></p><h1></h1></div>
*MultiplicationRepeats an element $N$ times.li*3<li></li><li></li><li></li>
()GroupingGroups elements for complex nesting.(header>ul)+footer<header><ul></ul></header><footer></footer>

2. HTML Attributes & Content

How to add classes, IDs, text, and custom attributes without typing standard HTML.

FeatureSyntaxExample InputExpanded Output
ID#div#container<div id="container"></div>
Class.p.text-red<p class="text-red"></p>
Custom Attr[]td[title="Hello" colspan=3]<td title="Hello" colspan="3"></td>
Text{}a{Click Me}<a href="">Click Me</a>
Implicit Tag(None).class (inside a ul)<li class="class"></li>

3. Lists, Iteration & Numbering

This is the most powerful feature for generating repetitive structures (menus, lists, grids).

FeatureSyntaxDescriptionExample Input
Numbering$Adds the current number (1, 2, 3).li.item$*3 > class="item1", item2, item3
Pad Zeros$$Adds zero-padding (01, 02).li.item$$*3 > class="item01", item02
Reverse@-Counts backwards.li.item$@-*3 > item3, item2, item1
Start At@NStarts counting from number $N$.li.item$@10*3 > item10, item11, item12
Text Numbering{$}Puts number inside text content.a{Link $}*3 > Link 1, Link 2, Link 3

4. Special Emmet Syntax Filters

These are appended to the end of an abbreviation to change how the code is rendered.

FilterSyntaxFunction
Comment`c`
Escape`e`
BEM-(Double dash inside class) Shortens BEM syntax.
BEM Mod_(Underscore inside class) Shortens BEM modifier.

5. Implicit Tag Names

If you type only a class or ID, Emmet guesses the tag based on the parent.

ParentImplicit Child TagExampleOutput
ul, olliul>.item<ul><li class="item"></li></ul>
table, tbody, thead, tfoottrtable>.row<table><tr class="row"></tr></table>
trtdtr>.cell<tr><td class="cell"></td></tr>
select, optgroupoptionselect>.opt<select><option class="opt"></option></select>
mapareamap>.area<map><area class="area"></map>
headmeta
svgpath

6. HTML and CSS Boilerplates

1. HTML: Document Structure & Meta Tags

AbbreviationExpands To
! / html:5<!DOCTYPE html><html lang="en"><head>...</head><body>...</body></html>
html:4sHTML 4.01 Strict boilerplate
html:4tHTML 4.01 Transitional boilerplate
html:xtXHTML 1.0 Transitional boilerplate
html:xsXHTML 1.0 Strict boilerplate
meta:utf<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
meta:vp<meta name="viewport" content="width=device-width, initial-scale=1.0">
meta:compat<meta http-equiv="X-UA-Compatible" content="IE=7">
script:src<script src=""></script>
link:css<link rel="stylesheet" href="style.css">
link:print<link rel="stylesheet" href="print.css" media="print">
link:favicon<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
link:touch<link rel="apple-touch-icon" href="favicon.png">
link:rss<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
link:atom<link rel="alternate" type="application/atom+xml" title="Atom" href="atom.xml">
style<style></style>

2. HTML: Sectioning & Grouping

AbbreviationExpands To
sect<section></section>
art<article></article>
hdr<header></header>
ftr<footer></footer>
adr<address></address>
nav<nav></nav>
main<main></main>
asd<aside></aside>
h1 ... h6<h1></h1> ... <h6></h6>
hgroup<hgroup></hgroup>
div<div></div>
p<p></p>
bq<blockquote></blockquote>
fig<figure></figure>
figc<figcaption></figcaption>
hr<hr>

3. HTML: Lists & Tables

AbbreviationExpands To
ul<ul></ul>
ol<ol></ol>
li<li></li>
dl<dl></dl>
dt<dt></dt>
dd<dd></dd>
table<table></table>
tr<tr></tr>
td<td></td>
th<th></th>
thead<thead></thead>
tbody<tbody></tbody>
tfoot<tfoot></tfoot>
colg<colgroup></colgroup>
col<col>
cap<caption></caption>

4. HTML: Forms & Input

AbbreviationExpands To
form<form action=""></form>
form:get<form action="" method="get"></form>
form:post<form action="" method="post"></form>
label<label for=""></label>
fieldset<fieldset></fieldset>
leg<legend></legend>
inp<input type="text">
input:t<input type="text" name="" id="">
input:p<input type="password" name="" id="">
input:h<input type="hidden" name="">
input:c<input type="checkbox" name="" id="">
input:r<input type="radio" name="" id="">
input:s<input type="submit" value="">
input:b<input type="button" value="">
input:res<input type="reset" value="">
input:f<input type="file" name="" id="">
input:i<input type="image" src="" alt="">
input:d<input type="date" name="" id="">
input:dt<input type="datetime" name="" id="">
input:dtl<input type="datetime-local" name="" id="">
input:m<input type="month" name="" id="">
input:wk<input type="week" name="" id="">
input:time<input type="time" name="" id="">
input:num<input type="number" name="" id="">
input:color<input type="color" name="" id="">
input:search<input type="search" name="" id="">
input:email<input type="email" name="" id="">
input:url<input type="url" name="" id="">
input:tel<input type="tel" name="" id="">
select<select name="" id=""></select>
opt<option value=""></option>
optg<optgroup label=""></optgroup>
textarea<textarea name="" id="" cols="30" rows="10"></textarea>
btn<button></button>
btn:s<button type="submit"></button>
btn:r<button type="reset"></button>
btn:d<button disabled="disabled"></button>

5. HTML: Inline & Media

AbbreviationExpands To
a<a href=""></a>
a:link<a href="http://"></a>
a:mail<a href="mailto:"></a>
a:tel<a href="tel:"></a>
img<img src="" alt="">
pic<picture></picture>
src<source src="" type="">
ifr<iframe src="" frameborder="0"></iframe>
emb<embed src="" type="">
obj<object data="" type=""></object>
vid<video src=""></video>
aud<audio src=""></audio>
map<map name=""></map>
area<area shape="" coords="" href="" alt="">
span<span></span>
em<em></em>
strong<strong></strong>
q<q></q>
s<s></s>
small<small></small>
u<u></u>
mark<mark></mark>
bdi<bdi></bdi>
bdo<bdo dir=""></bdo>

6. CSS: Position & Layout

AbbreviationPropertyValue
pospositionrelative
pos:spositionstatic
pos:apositionabsolute
pos:rpositionrelative
pos:fpositionfixed
t / r / b / ltop / right / bottom / leftauto
zz-index
flfloatleft
frfloatright
fnfloatnone
clclearboth
ddisplayblock
dndisplaynone
dibdisplayinline-block
didisplayinline
dfdisplayflex
dgdisplaygrid
dtdisplaytable
vvisibilityhidden
ovoverflowhidden
ov:aoverflowauto
ov:soverflowscroll
ovx / ovyoverflow-x / overflow-yhidden
cpclipauto

7. CSS: Flexbox & Grid

AbbreviationPropertyValue
fxdflex-direction
fxd:rflex-directionrow
fxd:rrflex-directionrow-reverse
fxd:cflex-directioncolumn
fxd:crflex-directioncolumn-reverse
fxwflex-wrapnowrap
fxw:wflex-wrapwrap
jcjustify-content
jccjustify-contentcenter
jcsbjustify-contentspace-between
jcsajustify-contentspace-around
jcfejustify-contentflex-end
jcfjustify-contentflex-start
aialign-items
aicalign-itemscenter
aisalign-itemsstretch
aibalign-itemsbaseline
acalign-content
asalign-self
fxflex
ordorder
gtagrid-template-areas
gtcgrid-template-columns
gtrgrid-template-rows
gagrid-area
gggrid-gap

8. CSS: Box Model (Margin/Padding/Size)

AbbreviationPropertyNotes
mmarginm10 > margin: 10px;
mt / mr / mb / mlmargin-top/right...mt5 > margin-top: 5px;
ppaddingp10 > padding: 10px;
pt / pr / pb / plpadding-top/right...
wwidthw100p > width: 100%;
hheighth100vh > height: 100vh;
maw / miwmax-width / min-width
mah / mihmax-height / min-height
bxzbox-sizingborder-box
bxz:cbbox-sizingcontent-box

9. CSS: Typography & Text

AbbreviationPropertyValue / Note
ccolor#000
fzfont-size
fffont-family
fwfont-weight
fw:bfont-weightbold
tatext-alignleft
tactext-aligncenter
tartext-alignright
tajtext-alignjustify
tdtext-decorationnone
td:utext-decorationunderline
tttext-transformuppercase
tt:ltext-transformlowercase
tt:ctext-transformcapitalize
lhline-height
lsletter-spacing
whswhite-space
whs:nwhite-spacenowrap
whs:pwhite-spacepre
wobword-break
towtext-overflowellipsis

10. CSS: Background & Borders

AbbreviationPropertyValue / Note
bgbackground#000
bgcbackground-color#fff
bgibackground-imageurl()
bgrbackground-repeat
bgr:nbackground-repeatno-repeat
bgpbackground-position0 0
bgsbackground-size
bgs:cvbackground-sizecover
bgs:ctbackground-sizecontain
bdborder1px solid #000
bd+border1px solid #000
bd:nbordernone
bdbborder-bottom
bdtborder-top
bdrborder-right
bdlborder-left
brborder-radius
bdclborder-collapsecollapse

11. CSS: Visual Effects

AbbreviationPropertyValue
opopacity
bxshbox-shadowinset h v blur spread color
tshtext-shadowh v blur color
trftransform
trstransitionprop time func delay
animanimation
curcursorpointer
cur:acursorauto
ususer-selectnone