Emmet 介紹 – 縮寫篇

縮寫這樣的編輯方式是Emmet的核心功能,可以在輸入簡短的代碼後轉換成結構複雜的HTML,而且使用方式跟使用CSS的選取器雷同,所以非常易於使用。例如:

page>div.logo+ul#navigation>li*5>a{Item $}
------

<div id="page">
    <div class="logo"></div>
    <ul id="navigation">
        <li><a href="">Item 1</a></li>
        <li><a href="">Item 2</a></li>
        <li><a href="">Item 3</a></li>
        <li><a href="">Item 4</a></li>
        <li><a href="">Item 5</a></li>
    </ul>
</div>

以下分別介紹各種不同的縮寫撰寫模式

子結構:>

div>ul>li
------

<div>
    <ul>
        <li></li>
    </ul>
</div>

同層結構:+

div+p+bq
------

<div></div>
<p></p>
<blockquote></blockquote>

上一層:^

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

<div></div>
<div>
    <p><span></span><em></em></p>
    <blockquote></blockquote>
</div>
div+div>p>span+em^^^bq
------

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

乘法:*

ul>li*5
------

<ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>

分組:( )

div>(header>ul>li*2>a)+footer>p
------

<div>
    <header>
        <ul>
            <li><a href=""></a></li>
            <li><a href=""></a></li>
        </ul>
    </header>
    <footer>
        <p></p>
    </footer>
</div>
(div>dl>(dt+dd)*3)+footer>p
------

<div>
    <dl>
        <dt></dt>
        <dd></dd>
        <dt></dt>
        <dd></dd>
        <dt></dt>
        <dd></dd>
    </dl>
</div>
<footer>
    <p></p>
</footer>

項目編號:$

ul>li.item$*5
------

<ul>
    <li class="item1"></li>
    <li class="item2"></li>
    <li class="item3"></li>
    <li class="item4"></li>
    <li class="item5"></li>
</ul>
ul>li.item$$*5
------

<ul>
    <li class="item001"></li>
    <li class="item002"></li>
    <li class="item003"></li>
    <li class="item004"></li>
    <li class="item005"></li>
</ul>
ul>li.item$@-*5
------

<ul>
    <li class="item5"></li>
    <li class="item4"></li>
    <li class="item3"></li>
    <li class="item2"></li>
    <li class="item1"></li>
</ul>
ul>li.item$@3*5
------

<ul>
    <li class="item3"></li>
    <li class="item4"></li>
    <li class="item5"></li>
    <li class="item6"></li>
    <li class="item7"></li>
</ul>
ul>li.item$@-3*5
------

<ul>
    <li class="item7"></li>
    <li class="item6"></li>
    <li class="item5"></li>
    <li class="item4"></li>
    <li class="item3"></li>
</ul>

內容:{ }

a{Click me}
------

<a href="">Click me</a>
p>{Click }+a{here}+{ to continue}
------

<p>Click <a href="">here</a> to continue</p>

ID and Class

div#header+div.page+div#footer.class1.class2.class3
------

<div id="header"></div>
<div class="page"></div>
<div id="footer" class="class1 class2 class3"></div>

自訂屬性

td[title="Hello world!" colspan=3]
------

<td title="Hello world!" colspan="3"></td>

You may also like...

14,012 Responses

  1. Luke’s Episcopal Hospital. Pinon was really a rail worker in Texas with a big tumor rising from his head.

  2. Quicksand is nothing greater than a soupy mixture of sand and water.

  3. Yeah, sure. I might love to see the cities the place the previous Olympics were held.

  4. Lincoln’s three-speed automatic transmission was carried over with minor inner improvements and a quadrant shifted from the steering column into the instrument cluster.

  5. You’re as near the sea as attainable and when you’re near the sea, you’re near the calm expanse it passes on to your mind.

  6. Can you identify this superhero with out his eyebrows?

  7. Предлагаем услуги профессиональных инженеров офицальной мастерской.
    Еслли вы искали ремонт посудомоечных машин midea, можете посмотреть на сайте: ремонт посудомоечных машин midea
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  8. Предлагаем услуги профессиональных инженеров офицальной мастерской.
    Еслли вы искали ремонт посудомоечных машин beko рядом, можете посмотреть на сайте: ремонт посудомоечных машин beko сервис
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  9. Proceed to the next part to test your Christmas meals knowledge with our enjoyable Christmas food trivia questions.

  10. The vessel changed the capacity that left the Seabourn model with the sale of Seabourn Delight, Seabourn Spirit and Seabourn Legend.

  11. You will need to suppose about the bodily and geological circumstances you will be gardening under, as nicely because the all-vital query of grass.

  12. Keep your computer or cellular machine physically secure by leaving it at residence or holding it in sight always.

  13. An alternative choice that can work with any operating system above iOS8 is Dr.

  14. The ninety-nine names of God, verses from the Qur’an, and sayings of the Prophet Muhammad (hadith), for example, are appropriated and regenerated into texts that are meant to be good omens.

  15. In apocalypse eventualities, ammo will quickly turn out to be highly desirable, extremely uncommon, and strikingly expensive.

  16. In fact, if a packet is lost, there is no sequence quantity to read.

  17. If the market interest rates fallen, the coupon interest rate will be adjusted to lower.

  18. You should be accommodative to the wants and roles of your crew members and have to work hand-in-hand for the expansion of your organization or brand.

  19. It has up to now been known as a “sitdown suspended” coaster, because though it’s a standard sitdown coaster, the trains can tilt from aspect to aspect, like a suspended coaster, giving it its identify.

  20. However, hurricanes that “stall” near water may grow to be large rain producers and sources of flooding.

  21. Allow them to know that you鈥檙e there for assist every time they鈥檙e prepared to talk.

  22. No matter what type of heating and cooling system you might have, there are several issues you can do to keep the system in top condition.

  23. Have you guys ever gone on an prolonged trip collectively?

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。