Emmet 網頁開發界的超跑

在這個速度的時代,網頁也擁有非常多加速開發的工具,例如今天要介紹的這個外掛「Emmet」,他支援的開發軟體也相當多,也就是不管腳踏車、機車還是房車,都可以裝上這個超跑的引擎,廢話不多說,先讓大家知道他如何節省網頁開發的時間,如果我們在網頁上要輸入以下的HTML結構:

<div>
    <ul>
       <li><a href="#">選項1</a></li>
       <li><a href="#">選項2</a></li>
       <li><a href="#">選項3</a></li>
       <li><a href="#">選項4</a></li>
       <li><a href="#">選項5</a></li>
       <li><a href="#">選項6</a></li>
    </ul>
</div>

在我們安裝好Emmet之後,僅需輸入以下的縮寫,再按下Tab鍵,即可以產生如上述般的HTML結構:

div>ul>li*6>a[#]{選項$}

仔細看看應該不難發現HTML標籤名稱的部分都在縮寫裡面,只是利用>來區隔每一層,如果要多個同樣的標籤可以用*後來輸入個數,標籤內的屬性值是利用[ ]來包住,{ }是標籤內的值。

是不是很神奇呀?趕快到Emmet的官方網頁下載或直接利用你的網頁編輯器來安裝這個外掛吧!

Emmet 官方網站截圖
Emmet 官方網站截圖

官方網站提到Emmet的特色有六點,分別是:

  • HTML from CSS:如果你已經對CSS的選取器有概念,那就已經知道Emmet該如何去縮寫你的HTML代碼。
  • Dynamic snippets:在使用縮寫的時候,只要稍微更動一些名稱,就可以得到截然不同的結果。
  • Ultra-fast coding:快速的編寫模式,可以快速選取標籤、移動游標、產生上一層或下一層結構。
  • Customizable:可以透過編輯JSON檔案來客製化一些程式碼。
  • Platform for new tools:透過編輯開放的程式碼,可以產生新的使用模式。
  • Highly portable:高度輕便可攜。

Emmet支援的網頁編輯器也非常多,如下圖所示:

Emmet 支援的網頁編輯器

Emmet 支援的網頁編輯器

快速鍵:

(快速鍵的部分有可能跟原先的編輯器或電腦的一些應用程式有衝突而無法使用)

  • Tab:展開縮寫
  • Ctrl+Alt+→:將游標移動到下一個可以輸入屬性或值的地方。
  • Ctrl+Alt+←:將游標移動到上一個可以輸入屬性或值的地方。
  • Ctrl+D:選取一整個標籤(包含標籤的起始與結束)。
  • Shift+Ctrl+.:選取下一個標籤或屬性。
  • Shift+Ctrl+,:選取上一個標籤或屬性。
  • Ctrl+/:將選取的部分變成註解。

使用的部分功能相當多,可以參考官方網頁中的文件介紹,或是繼續閱讀馬老師針對Emmet的後續介紹。

You may also like...

1,167 Responses

  1. Cthrinepisn表示:

    cheap custom essay papers
    best online essay editing service
    research essay help

  2. Website Link表示:

    Our community leaders need to read this, and look at developing some of your recommendations.

  3. It’s remarkable designed fοr me to have a web site, whіch iѕ helpful for my know-how.
    thankѕ admin

    Μy site: panel jam tayang murah

  4. cooe表示:

    When are you going to take this to a full book?

  5. Leilahpisn表示:

    best website to buy essays
    buy essay online for cheap
    essays on the help

  6. Leilahpisn表示:

    essay writing website
    customized essays
    essay writing service ratings

  7. lonpao.com表示:

    you’re in reality a just right webmaster. The web site loading velocity is incredible. It sort of feels that you’re doing any distinctive trick. In addition, The contents are masterpiece. you’ve performed a great process on this topic!

  8. Twylapisn表示:

    best online essay writing service
    custom college essay writing service
    history essay help

  9. Twylapisn表示:

    nursing essay help
    essay introduction help
    admission college essay help

  10. Dronapisn表示:

    essay writing websites
    your essay writer
    write my essay for me cheap

  11. Dronapisn表示:

    i need help on writing an essay
    top essay editing service
    buy an essay paper

  12. informate表示:

    We can see that we need to develop policies to deal with this trend.

  13. With internet full of dupe articles it is nice to find original content like yours thank you so very much.

  14. Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader

  15. Charopisn表示:

    college application essay help online
    pay you to write my essay
    custom essay writing sites

  16. Charopisn表示:

    help me write essay
    college application essay services
    customer essay

  17. Thanks fⲟr tһe marvelous posting! I qᥙite enjoyed
    reading іt, yoս may Ьe a grеаt author.I will
    Ƅe ѕure t᧐ bookmark you blog and will often come back lаter on. I wantt to encourage yⲟurself to continie үоur grеat writing, һave a nice holidy weekend!

    Looк ɑt my web paɡe: jasa 4000 jam tayang

  18. Greetings! Ⅴery helpful advice within tһiѕ post! It iѕ the little ϲhanges tһat maкe thе largest chаnges.
    Ƭhanks a lοt for sharing!

    Aⅼѕo visit my һomepage … beli jam tayang

  19. Rhiamonpisn表示:

    help writing a comparison and contrast essay
    history essay help
    essay writer helper

  20. Rhiamonpisn表示:

    best essay writing
    write my essays
    what is the best college essay editing service

  21. DABAKAWLBIXvi表示:

    oral diovan 80 mg cost valsartan diovan for sale

  22. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that.|

  23. DABAKAWLBIXnl表示:

    buy generic valsartan diovan 80 mg oral diovan 80 mg oral

  24. It is in point ߋf faсt a ցreat aand սseful piee of informatіon. Ι’m
    glad that youu simply shared thiѕ helpful info ѡith ᥙѕ.
    Pleaase stay ᥙs informed lile tһіѕ. Thank youu for sharing.

    Review mʏ page – paket jam tayang

  25. XsaYaylLiZgt表示:

    On this site u can buy all known KILLA FLASH 4mg for very good price!

  26. Antoniepisn表示:

    college admission essay service
    essay on helping poor people
    essay writer helper

  27. Antoniepisn表示:

    can i pay someone to write my essay
    websites for essay writing
    argument essay help

  28. I’ve thought about posting something about this before. Good job! Can I use part of your post in my blog?

發佈留言

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