Topic 3B: Emmet: HTML Abbreviations
Master HTML abbreviations with powerful Emmet shortcuts
Type any abbreviation and hit Tab to expand it into full HTML code. Emmet uses CSS-like syntax to make HTML coding faster and more efficient.
After typing content into the h1 tag, hit Tab to jump directly inside the p tag for efficient content entry.
After typing content into the h1 tag, hit Tab to jump directly inside the p tag for efficient content entry.
Basic HTML Elements
Heading Elements
Use h1, h2, h3, etc. to quickly generate heading tags with proper opening and closing syntax.
Content Elements
Elements like p for paragraphs and img for images automatically include required attributes like src and alt.
Container Elements
The div element creates the fundamental building block for page layout and content organization.
ID vs Class Selectors
| Feature | ID (#myElement) | Class (.myElement) |
|---|---|---|
| Symbol | # | . |
| Output | id attribute | class attribute |
| Default Element | div | div |
| Usage | Unique identifier | Reusable styling |
ID vs Class Selectors
| Feature | ID (#myElement) | Class (.myElement) |
|---|---|---|
| Symbol | # | . |
| Output | id attribute | class attribute |
| Default Element | div | div |
| Usage | Unique identifier | Reusable styling |
When you want a class on a specific element type, specify the element first, then the class. For example, ul.myList creates a ul element with the myList class.
Understanding Emmet Multiplication
Parent Element
Start with the container element (ul for unordered list)
Child Operator
Use > to indicate direct child relationship
Multiplication
Add *3 to create three identical child elements automatically
Advanced Emmet Operators
Child Operator (>)
Creates parent-child relationships between elements. Essential for proper HTML nesting structure.
Sibling Operator (+)
Places elements at the same level. Perfect for creating adjacent content blocks.
Multiplication (*)
Repeats elements the specified number of times. Saves significant time when creating lists or grids.
Numbering ($)
Automatically increments numbers in class names, IDs, or attributes for each repeated element.
Emmet uses CSS attribute selector syntax with square brackets. Learn more about attribute selectors at css-tricks.com/attribute-selectors for advanced CSS techniques.
Understanding Emmet Multiplication
Parent Element
Start with the container element (ul for unordered list)
Child Operator
Use > to indicate direct child relationship
Multiplication
Add *3 to create three identical child elements automatically
When you want a class on a specific element type, specify the element first, then the class. For example, ul.myList creates a ul element with the myList class.
After typing content into the h1 tag, hit Tab to jump directly inside the p tag for efficient content entry.
Basic HTML Elements
Heading Elements
Use h1, h2, h3, etc. to quickly generate heading tags with proper opening and closing syntax.
Content Elements
Elements like p for paragraphs and img for images automatically include required attributes like src and alt.
Container Elements
The div element creates the fundamental building block for page layout and content organization.
After typing content into the h1 tag, hit Tab to jump directly inside the p tag for efficient content entry.
Advanced Emmet Operators
Child Operator (>)
Creates parent-child relationships between elements. Essential for proper HTML nesting structure.
Sibling Operator (+)
Places elements at the same level. Perfect for creating adjacent content blocks.
Multiplication (*)
Repeats elements the specified number of times. Saves significant time when creating lists or grids.
Numbering ($)
Automatically increments numbers in class names, IDs, or attributes for each repeated element.
Emmet uses CSS attribute selector syntax with square brackets. Learn more about attribute selectors at css-tricks.com/attribute-selectors for advanced CSS techniques.
Advanced Emmet Operators
Child Operator (>)
Creates parent-child relationships between elements. Essential for proper HTML nesting structure.
Sibling Operator (+)
Places elements at the same level. Perfect for creating adjacent content blocks.
Multiplication (*)
Repeats elements the specified number of times. Saves significant time when creating lists or grids.
Numbering ($)
Automatically increments numbers in class names, IDs, or attributes for each repeated element.
Emmet uses CSS attribute selector syntax with square brackets. Learn more about attribute selectors at css-tricks.com/attribute-selectors for advanced CSS techniques.
Emmet Best Practices
The Tab key is the universal trigger for Emmet expansion across editors
Create complex HTML structures with single abbreviations for maximum efficiency
Change the number after lorem to generate exactly the amount of placeholder text you need
Keep docs.Emmet.io/cheat-sheet bookmarked for comprehensive abbreviation reference
Master combining >, +, *, and $ operators for advanced HTML structure generation
Key Takeaways