search
HomeWeb Front-endHTML TutorialUnknown Emmet Grammar Rules

Unknown Emmet Grammar Rules

Apr 14, 2021 am 11:21 AM
emmethtml

This article will give you a detailed introduction to the grammatical rules of HTML shorthand Emmet. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

Unknown Emmet Grammar Rules

#Emmet—Writing HTML/CSS is so fast

In the process of front-end development, the most time-consuming work is writing HTML and CSS code. A bunch of tags, attributes, brackets, etc., which is a headache. Here is an Emmet grammar rule recommended, which will make you feel super happy when writing. It can greatly improve your code writing. You only need to type one line of code to generate the complete HTML structure you want. The following will introduce how to use it.

Emmet is a plug-in that can be used by any editor that can install it. Most editors can use this grammar rule. We usually develop Sublime Text, Eclipse, Notepad, VS code, Atom, Dreamweaver and other editors can be used.

The installation method is the same as usual installation of plug-ins. Search for this emmet plug-in installation. Each editor has different installation methods. Please try each one.

1: html initial structure

With the structure in the picture below, anyone who is lazy will just follow it! => Tab solution, which can quickly generate the basic structure and prevent forgetting a certain code block and entering wrong code when writing by hand.
Unknown Emmet Grammar Rules

2: id(#),class(.)

id command:#; class command:.

  • p#test
<p id="test"></p>
  • p.test
<p class="test"></p>

3: Child node (>), sibling node ( ), superior Node (^)

Child node command:> ; Sibling node command: ; Superior node:^

  • p>ul>li>p
<p>
   <ul>
     <li>
       <p></p>
     </li>
   </ul>
 </p>
  • p ul p
<p></p>
<ul></ul>
<p></p>
  • p>ul>li^p (The ^ here is connected after li, so it is one level above li, and ul They have become brothers, of course the two ^^ are superiors)
<p>
   <ul>
     <li></li>
   </ul>
   <p></p>
 </p>

4: Repeat (*)

Repeat command: *

  • p*5 (Add a number after the * sign to indicate the number of repeated elements)
   <p></p>
   <p></p>
   <p></p>
   <p></p>
   <p></p>

5: Grouping (())

Grouping instructions: ()

    ##p>(ul>li>a) p>p
  • (The content inside the brackets is a code block, indicating the level of nesting inside and outside the brackets Unrelated)
  • <p>
       <ul>
         <li><a href=""></a></li>
       </ul>
       <p>
         <p></p>
       </p>
     </p>
Explanation: If there are no parentheses here, guess, a p and p are brothers to a, and will be included in li. Got it, hahahaha

 <p>
   <ul>
     <li>
       <a href=""></a>
       <p>
         <p></p>
       </p>
     </li>
   </ul

6: Attribute ([attr]) - id, class, how can I miss the attribute?

Attribute command: []

    a[href='
  • ' name='xiaoA'] (Fill in the form of attribute key-value pairs in square brackets and separate them with spaces)
<a href="###" name="xiaoA"></a>


6: Number ($)

Numbering command: $
  • ul>li.test$*3 ($ represents one digit, and the * number after it represents increasing from 1 to the number filled in)

 <ul>
   <li class="test1"></li>
   <li class="test2"></li>
   <li class="test3"></li>
 </ul>

Note:
  • A $ represents one digit, $$ is a two-digit number, and so on to form $(1 ),$$(01),$$$(001)

  • If you want to customize the number from which to increment, use: $@ number*number
  • For example: ul>li*3.test$ @3

 <ul>
   <li class="test3"></li>
   <li class="test4"></li>
   <li class="test5"></li>
 </ul>
7: Text ({})

Text command: {}
  • ul>li.test $*3{Test$} ({Fill in the content inside, it can be combined with $})

<ul>
  <li class="test1">测试1</li>
  <li class="test2">测试2</li>
  <li class="test3">测试3</li>
</ul>
8: Implicit tag

this Tags do not have instructions, but some tags can identify parent tags by directly inputting instructions without using input tags.

For example: .test

<p class="test"></p>

For example: ul>.test$*3

 <ul>
   <li class="test1"></li>
   <li class="test2"></li>
   <li class="test3"></li>
 </ul>

For example: select>.test$*5

<select name="" id="">
  <option class="test1"></option>
  <option class="test2"></option>
  <option class="test3"></option>
  <option class="test4"></option>
  <option class="test5"></option>
</select>

, etc. Wait...

The privacy tags are as follows:
  • li: used in ul and ol
  • tr: used in table, tbody, thead and tfoot
  • td: used in tr
  • option: used in select and optgroup

Recommended learning: html video tutorial

###

The above is the detailed content of Unknown Emmet Grammar Rules. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete
The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment