Label shorthand

HTML code shorthand

All operations can be completed instantly by pressing the "tab" key

1. Use ">" to generate sub-elements (quickly generate code blocks)

2. Use "+" to generate sibling elements

3. Use "^" to generate the parent element

// 输入
div+div>p>span+em^h4
 
// 按下TAB键
<div></div>
<div>
    <p><span></span><em></em></p>
    <h4></h4>
</div>

4. Use "*" to generate multiple identical elements

// 输入
div>ul>li*5
 
// 按下TAB键
<div>
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</div>

5. Use "()" to group elements

// 输入
// "+" 后面的元素与括号中的第一个元素属于兄弟关系
div>(header>ul>li*2)+footer>p
 
//按下TAB键
<div>
    <header>
        <ul>
            <li></li>
            <li></li>
        </ul>
    </header>
    <footer>
        <p></p>
    </footer>
</div>


Attribute operation

1. id and class: elements and id attribute values ​​are separated by "#", and class attribute values ​​are separated by "."

// 输入
div#header+div.page+div#footer.class1.class2.class3
 
// 按下TAB键
<div id="header"></div>
<div class="page"></div>
<div id="footer" class="class1 class2 class3"></div>

2. Use "[]" to mark other attributes

// 输入
td[title='hello' colspan=3]
 
// 按下TAB键
<td title="hello" colspan="3"></td>

3. Use the "$" symbol to achieve automatic numbering from 1 to n ("*" to achieve multiple elements)

/ 输入
li.item$*3
 
// 按下TAB键
<li class="item1"></li>
<li class="item2"></li>
<li class="item3"></li>

You can add "@n" after "$" to modify the starting value of the number to n.

// 输入
li.item$@3*3
 
// 按下TAB键
<li class="item3"></li>
<li class="item4"></li>
<li class="item5"></li>

You can add "@-" after "$" to modify the direction of the number.

// 输入
li.item$@-3*3
 
// 按下TAB键
<li class="item5"></li>
<li class="item4"></li>
<li class="item3"></li>

4. Use "{}" to add text content

// 输入
a[href=me.htm]{click me}
 
// 按下TAB键
<a href="me.htm">click me</a>

Guess you like

Origin www.cnblogs.com/xueba/p/12744107.html
Recommended