Amazing Emmet shortcuts for HTML and CSS to code faster
Rakesh Potnuru
written by Rakesh Potnuru3 min read

Amazing Emmet shortcuts for HTML and CSS to code faster

Emmet is one of the most useful extensions which are used to write lines of code with a single shortcut. Here are some top Emmet shortcuts to save your time ⏳.

Prerequisites

  1. Make sure you have Emmet extension installed in your code editor.
  1. Knowledge on HTML, CSS

Let’s get started

Let’s get started

1. Sibling - +

main+section+footer

<main></main>
<section></section>
<footer></footer>

2. Child - >

html>body>main>h1

<html>
<body>
    <main>
        <h1></h1>
    </main>
</body>
</html>

3. Climb-up - ^

Each ^ makes the element separate from previous element by one level.

div+div>p>span+em^^bq

<div></div>
<div>
    <p><span></span><em></em></p>
</div>
<blockquote></blockquote>

4. Multiplication - *

select>option*3

<select name="" id="">
    <option value=""></option>
    <option value=""></option>
    <option value=""></option>
</select>

5. Item numbering - $

h$[title=item$]{Header $}*3

<h1 title="item1">Header 1</h1>
<h2 title="item2">Header 2</h2>
<h3 title="item3">Header 3</h3>

Reverse

h$@-*3

<h3></h3>
<h2></h2>
<h1></h1>

Start from

h$@3*5

<h3></h3>
<h4></h4>
<h5></h5>
<h6></h6>
<h7></h7>

6. Grouping - ()

You can’t do something like this main>h1+footer. These is where grouping helps.

(main>h1)+footer

<main>
    <h1></h1>
</main>
<footer></footer>

7. ID and CLASS attributes - #,.

form#search.wide

<form id="search" class="wide"></form>

div.class1.class2

<div class="class1 class2"></div>

8. Custom attributes

input[type="password" name="password"]

<input type="password" name="password">

9. Text - {}

button{Click me}

<button>Click me</button>

10. Implicit tag names

table>.row>.col

<table>
    <tr class="row">
        <td class="col"></td>
    </tr>
</table>

Now see some CSS 🥶

pos:f

position:fixed;

d:if

display:inline-flex;

d:tbclg

display:table-column-group;

mb:a

margin-bottom:auto;

bxsh

box-shadow:inset hoff voff blur color;

ff:ss

font-family:sans-serif;

whs:nw

white-space:nowrap;

bgc:t

background-color:transparent;

bd+

border:1px solid #000;

trf:t3

transform: translate3d(tx, ty, tz);

anim-

animation:name duration timing-function delay iteration-count
direction fill-mode;

@kf

@-webkit-keyframes identifier {
    from {  }
    to {  }
}
@-o-keyframes identifier {
    from {  }
    to {  }
}
@-moz-keyframes identifier {
    from {  }
    to {  }
}
@keyframes identifier {
    from {  }
    to {  }
}

That’s it

That’s it for today


Thanks for reading!


Loved this post?

Comments

Interested in
working
with me?