
Emmet abbreviations help you write HTML and CSS faster. Type a short expression and expand it into complete markup. This is especially useful for repeated tags, nested elements, and common page structures.
How to use Emmet in Visual Studio Code
Emmet is built into Visual Studio Code. Open an HTML file, type an abbreviation, and choose the Emmet suggestion. You can also use the Emmet: Expand Abbreviation command. In a CSS file, try Emmet’s CSS abbreviations. See the official documentation for more options.
16 practical Emmet examples
1. Create a basic HTML document
Abbreviation: !
<!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>
2. Create a div with a class
Abbreviation: .container
<div class="container"></div>
3. Create a div with multiple classes
Abbreviation: div.class1.class2
<div class="class1 class2"></div>
4. Create an element with an ID and a class
Abbreviation: div#header.container
<div id="header" class="container"></div>
5. Create an unordered list
Abbreviation: ul>li*5
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
6. Create numbered classes on list items
Abbreviation: ul>li.item$*5
<ul>
<li class="item1"></li>
<li class="item2"></li>
<li class="item3"></li>
<li class="item4"></li>
<li class="item5"></li>
</ul>
7. Create a link with text
Abbreviation: a[href="https://google.com"]{Google}
<a href="https://google.com">Google</a>
8. Create a form with several fields
Abbreviation: form>input[type="text"]+input[type="email"]+input[type="submit"]
<form>
<input type="text">
<input type="email">
<input type="submit">
</form>
9. Create a table with rows and columns
Abbreviation: table>tr*3>td*3
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
10. Create a section with a heading and paragraph
Abbreviation: section>h2+p
<section>
<h2></h2>
<p></p>
</section>
11. Create several images with attributes
Abbreviation: img[src="image$"].image*3
<img src="image1" class="image">
<img src="image2" class="image">
<img src="image3" class="image">
12. Create a paragraph with text
Abbreviation: p{This is a paragraph}
<p>This is a paragraph</p>
13. Create a button with text
Abbreviation: button{Send}
<button>Send</button>
14. Create an image with alt and src attributes
Abbreviation: img[src="image.jpg" alt="Image description"]
<img src="image.jpg" alt="Image description">
15. Create a header with a heading and a link
Abbreviation: header>h1{Welcome}+a[href="#"]{Home}
<header>
<h1>Welcome</h1>
<a href="#">Home</a>
</header>
16. Create a text input with a placeholder
Abbreviation: input[type="text" placeholder="Type here"]
<input type="text" placeholder="Type here">
Try changing the repetition count, adding a class, or nesting a second element in one of these examples. Then expand it and check the result against what you expected.