search
HomeWeb Front-endHTML TutorialDetailed explanation of the use of Sublime Text plug-in Emmet

Summary:

Installation Please read the previous article Sublime Text-Installation, use it with sublime’s own shortcut keys, and write HTML quickly.

The following are commonly used. For complete information, please see the emmet official documentation.

Generate tags

1. Quickly generate document structure

nbsp;html>


    <meta>
    <title>Document</title>



  • html:xt Generate HTML4 transitional type

  • html:4s Generate HTML4 strict type

2. Generate elements with id

Tag # ID name, such as:

p#header

<p></p>
3. Generate elements with

class

tag. Class name, such as:

p.title

<p></p>
4. Generate descendant elements:>

Such as:

nav>ul>li

<nav>
    <ul>
        <li>
    </ul>
</nav>
5 .Generate sibling elements: +

such as:

p+p+p

<p></p>
<p></p>
<p></p>
6. Generate superior elements: ^

such as:

p^p

<p></p>
<p></p>
7. Repeatedly generate multiple elements: *

Such as:
ul>li*5

        
  •     
  •     
  •     
  •     

8. Generate from Definition

Attribute: [attr]

For example:

p[value=1]

<p></p>
9. Generate text content: {}

For example:

a{Click me}

<a>Click me</a>
10. Add number: $

  • Start from 1: add $

For example:

p.item${$$}*3

<p>01</p>
<p>02</p>
<p>03</p>
  • Reverse order: $ followed by @-

For example:

p.item$@-{$$@-}*3

<p>03</p>
<p>02</p>
<p>01</p>
  • Specify the serial number: you can use @N

For example:

p.item$@4{$$@4}*3

<p>04</p>
<p>05</p>
<p>06</p>
11.

Group: ()

For example:

(ul>ol)*3


        
          
            
        Let’s take a

        comprehensive case

        table#tab[value=1].a>tr*3>(td{$$}>span)*3

        
        
            
                
                
                
            
            
                
                
                
            
            
                
                
                
            
        01 02 03
        01 02 03
        01 02 03
        Generate css

        Many css styles , there are naturally many abbreviations, just list the commonly used ones and draw inferences.

        The css abbreviation is matched using fuzzy search, such as ov:h == ov-h == ovh == oh.

        • w10

          width<a href="http://www.php.cn/wiki/835.html" target="_blank">: 10px;</a> w10p width: 10%; w10e width: 10em; w10x width: 10xe;

        • h10

          height<a href="http://www.php.cn/wiki/836.html" target="_blank">: 10px;</a>

        • por

          position<a href="http://www.php.cn/wiki/902.html" target="_blank">: relative;</a> poa position: absolute;

        • fll

          float<a href="http://www.php.cn/wiki/919.html" target="_blank">: left;</a> fr float: right<a href="http://www.php.cn/wiki/905.html" target="_blank">;</a>

        • dt

          display<a href="http://www.php.cn/wiki/927.html" target="_blank">: table;</a> db display: block; dib display: inline-block;

        • ##ovy
        • overflow-y: hidden;<a href="http://www.php.cn/wiki/926.html" target="_blank"></a>

        • cb
        • clear: both;<a href="http://www.php.cn/wiki/917.html" target="_blank"></a>

          ##mt
        • margin-top

          : ; mb <a href="http://www.php.cn/wiki/933.html" target="_blank"></a>margin-bottom: ;<a href="http://www.php.cn/wiki/935.html" target="_blank"></a>

        • pt <a href="http://www.php.cn/wiki/949.html" target="_blank">padding-top</a>: ; pb <a href="http://www.php.cn/wiki/951.html" target="_blank">padding-bottom</a>: ;

        • tac <a href="http://www.php.cn/wiki/870.html" target="_blank">text-align</a>: center;

        • lh <a href="http://www.php.cn/wiki/864.html" target="_blank">line-height</a>:;

        • tsn <a href="http://www.php.cn/wiki/861.html" target="_blank">text-shadow</a>: none;

        • tja <a href="http://www.php.cn/wiki/881.html" target="_blank">text-justify</a>: auto;

        • c color: #000; cr color: rgb(0, 0, 0); cra color: rgba(0, 0, 0, .5);

        • op opacity: ;

        • cnt content: '';

        • ol <a href="http://www.php.cn/wiki/938.html" target="_blank">outline</a>: ;

        • bd+ border: 1px solid #000; bdb+ border-bottom: 1px solid #000;

        • bd2px#333s border: 2px #333 solid;

        快捷键

        如果没作用请检查快捷键是否冲突

        • 快速生成包裹标签:Ctrl+Shift+G

        只有文本没有结构时,如下

        首页
        简介
        动态

        选中文本按快捷键Ctrl+Shift+G,再弹出的:Enter Wrap Abbreviation(输入扩展缩写)中输入nav>ul>li.item$*>a就会生成

        <nav>
            <ul>
                <li><a>首页</a></li>
                <li><a>简介</a></li>
                <li><a>动态</a></li>
            </ul>
        </nav>

        如果原先的文本带编号,不想要则可以在上面的基础上加|t,nav>ul>li.item$*>a|t即可生成如上结果。

        1首页
        2简介
        3动态
        • 自动添加/更新图片尺寸:ctrl+U

        光标移到标签上的任意位置,按下快捷键ctrl+U即可。

        <img  src="/static/imghwm/default1.png" data-src="img/x1.png" class="lazy" alt="Detailed explanation of the use of Sublime Text plug-in Emmet" >
        <img  src="/static/imghwm/default1.png" data-src="img/x1.png" class="lazy" alt="Detailed explanation of the use of Sublime Text plug-in Emmet" >
        • 删除标签:shift+ctrl+;

        • 定位到上个编辑点:ctrl+alt+left

        • 定位到下个编辑点:ctrl+alt+right

        • 选中下一项:shift+ctrl+.

        • 加/减1:ctrl+up/ctrl+down

        • 加/减10:shift+alt+up/shift+alt+down

        • 展开缩写:ctrl+e(和tab键作用相同)

        • 重命名标签(rename_tag):ctrl+shift+'

        • 更换标签(update_as_you_type):ctrl+Shift+U

        • 匹配标签对:ctrl+alt+j

        生成测试文本

        输入lorem再按tab会随机生成一段英文,默认是生成30个单词,可以加上数字控制单词数量,如lorem5

        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis incidunt, expedita voluptates ratione praesentium error a accusamus corporis deleniti. Cum, debitis id, in rem exercitationem at voluptatum illum minima corporis!
        Lorem ipsum dolor sit amet.

        The above is the detailed content of Detailed explanation of the use of Sublime Text plug-in Emmet. For more information, please follow other related articles on the PHP Chinese website!

        Statement
        The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
        sublime怎么用replacesublime怎么用replaceApr 03, 2024 am 05:51 AM

        Sublime Text 替换功能允许用户搜索和替换文本。该功能可通过 "查找" 菜单中的 "替换" 选项启用。使用此功能的步骤包括:输入要搜索的文本、输入替换文本、选择是否启用正则表达式、选择替换所有或选择性替换。高级选项包括匹配大小写、匹配整个单词和使用选区。

        sublime怎么显示运行结果sublime怎么显示运行结果Apr 03, 2024 am 07:06 AM

        Sublime Text 中可通过以下三种方法显示运行结果:使用控制台窗口:打开控制台窗口并使用 print 语句打印结果。使用快速面板:打开快速面板,选择终端选项卡并运行代码。使用第三方插件:安装 SublimeREPL 或 Console 2 等插件,运行代码后结果将在专属窗口中显示。

        sublime怎么执行sublime怎么执行Apr 03, 2024 am 07:15 AM

        是,Sublime Text可以通过以下步骤执行代码:为特定编程语言安装插件配置构建系统创建构建文件使用键盘快捷键(Mac:Command + B;Windows/Linux:Control + B)执行代码

        sublime怎么编写python代码sublime怎么编写python代码Apr 03, 2024 am 05:30 AM

        在 Sublime Text 中编写 Python 代码,请按照以下步骤操作:安装 Sublime Text。创建新项目并保存文件为 .py。通过快捷键 Ctrl + B (Windows) / Cmd + B (Mac) 运行 Python 代码。此外,还可以通过安装 Python 插件、设置 Python 解释器、启用自动缩进和语法高亮等方式增强 Python 代码编写体验。

        phpstudy配置文件怎么改phpstudy配置文件怎么改Apr 02, 2024 pm 03:57 PM

        可以通过以下步骤修改 phpStudy 配置文件:找到配置文件(Windows:C:\Windows\phpStudy\php\php.ini;Mac:/Applications/phpStudy/php/php.ini)使用文本编辑器打开并查找要修改的设置编辑设置的值,如修改时区:date.timezone = Asia/Shanghai保存更改并重启 Apache 服务

        sublime怎么运行结果sublime怎么运行结果Apr 03, 2024 am 07:24 AM

        在 Sublime 中运行代码的方法包括:使用快捷键 (Ctrl + B)通过菜单 (工具 > 构建 > 运行)使用命令面板 (Ctrl + Shift + P > 输入“运行”)使用构建系统 (工具 > 构建系统 > 选择一个构建系统)设置默认构建系统 (首选项 > 设置 - 用户 > 添加“build_system”键值)

        怎么在sublime中安装pygame怎么在sublime中安装pygameApr 03, 2024 am 06:48 AM

        在 Sublime Text 中安装 Pygame 的步骤:确保已安装 Python 3。使用 pip 安装 pip。使用 pip 安装 Pygame。将 Pygame 路径添加到环境变量。验证安装是否成功。

        Flask和Sublime Text集成: Python web应用程序开发技巧(第六部分)Flask和Sublime Text集成: Python web应用程序开发技巧(第六部分)Jun 17, 2023 pm 04:08 PM

        Flask和SublimeText集成:Pythonweb应用程序开发技巧(第六部分)SublimeText和Flask都是Pythonweb应用程序开发中的重要工具。然而,如何将二者集成起来,使得开发过程更加高效呢?本文将介绍一些SublimeText的插件和配置技巧,帮助你更方便地开发Flask应用程序。一、安装SublimeText插件F

        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)
        2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
        R.E.P.O. Best Graphic Settings
        2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
        R.E.P.O. How to Fix Audio if You Can't Hear Anyone
        2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

        Hot Tools

        EditPlus Chinese cracked version

        EditPlus Chinese cracked version

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

        ZendStudio 13.5.1 Mac

        ZendStudio 13.5.1 Mac

        Powerful PHP integrated development environment

        Safe Exam Browser

        Safe Exam Browser

        Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

        Dreamweaver Mac version

        Dreamweaver Mac version

        Visual web development tools

        VSCode Windows 64-bit Download

        VSCode Windows 64-bit Download

        A free and powerful IDE editor launched by Microsoft