Write HTML and CSS 100x more faster

In the fast-paced world of web development, efficiency is key. Emmet, an essential tool integrated into modern text editors like Visual Studio Code (VSCode), empowers developers to write HTML and CSS swiftly and effectively. By leveraging Emmet's shorthand syntax and powerful features, you can streamline your coding process and boost productivity.



Emmet holds a special place as one of my favorite built-in features in VS Code. Additionally, it's widely accessible as an extension across various other code editors.

What is Emmet?

Emmet is a plugin originally known as Zen Coding, designed to simplify writing HTML and CSS with abbreviations and shortcuts. It allows developers to expand simple abbreviations into complex code snippets, reducing the need for repetitive typing and minimizing errors.

Think of Emmet as shorthand. With it, you can easily write a lot of code quickly. It dramatically speeds up your HTML & CSS workflow.

Basic Tags

To create basic HTML tags, simply type the tag's name and press Enter. Emmet automatically positions your cursor inside the tag, ready for you to continue typing.

For example, try typing `div` and pressing Enter, or `h1` Enter, or `p` Enter. Other shortcuts include:

- `bq` for `<blockquote>`

- `hdr` for `<header>`

- `ftr` for `<footer>`

- `btn` for `<button>`

- `sect` for `<section>`

Classes

If you are familiar with CSS, Emmet uses a similar syntax to refer to classes using a dot (`.`). To define a class along with the tag, simply add it like this:

- `div.wrapper` → `<div class="wrapper"></div>`

- `h1.header.center` → `<h1 class="header center"></h1>`

IDs

IDs work in a similar way:

- `div#hero` → `<div id="hero"></div>`

Combining

You can also combine classes and IDs:

- `div#hero.wrapper` → `<div id="hero" class="wrapper"></div>`

Climbing Up

You have to try to picture what you are building in your head as you type the Emmet shorthand. In this example we'll "climb up" the tree by using ^.

Result:

<div></div>
<div>
    <p><span></span><em></em></p>
    <blockquote></blockquote>
</div>
To learn more about Emmet, download the PDF guide. Click here to get started.



Follow our blog for usefull content related like web development, coding and free udemy course 

If you like this content: Buy me a coffee


Previous Post Next Post