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,168 Responses

  1. Antika Tablo表示:

    Hey, I simply hopped over to your website by way of StumbleUpon. No longer one thing I’d normally learn, but I preferred your thoughts none the less. Thanks for making one thing worth reading.

  2. XsaYdddLiZgt表示:

    On this site u can buy all known monedigo for very good price!

  3. PABAKAWLBIXzv表示:

    order cheap lyrica can you buy generic lyrica without a prescription where can i buy generic lyrica without dr prescription

  4. XsaYrddLiZgt表示:

    On this site u can buy all known Killa for very good price!

  5. gacorslot表示:

    We need to build frameworks and funding mechanisms.

  6. PABAKAWLBIXdt表示:

    how to buy lyrica price order lyrica for sale can you buy lyrica

  7. Admitle表示:

    To test if this defect could be due to a lack of vessel maturation, we determined the presence of vessel associated mural cells by performing immunostaining for О± smooth muscle actin О± SMA lasix brand name I m glad I made the switch

  8. scb99表示:

    However, it is virtually all done with tongues rooted solidly in cheeks, and everyone has absolutely nothing but absolutely love for his or her friendly neighborhood scapegoat. The truth is, he is not just a pushover. He is basically that special variety of person strong enough to take all of that good natured ribbing for exactly what it is.

  9. outwazy表示:

    hydrochlorothiazide vs lasix Your doctor usually considers your age and general health as well as your feelings about the treatment options

  10. Ginniepisn表示:

    service learning reflection essay
    best essay
    admissions essay help

  11. Ginniepisn表示:

    the best essay writing service
    essay writing service ratings
    personal essay writers

  12. LABAKAWLBIXpy表示:

    order lyrica 75 mg pills order pregabalin generic buy pregabalin 75 mg for sale

  13. Ι believe that iѕ аmong the mοst signifiocant info fοr me.
    And i am happy studying ypur article. However shouⅼd remark ߋn feѡ generaⅼ thіngs, Ꭲhе site taste іѕ wonderful, thе articles is in reality excellent :
    Ⅾ. Juѕt rіght task, cheers

    Mʏ web pɑge :: jual play spotify

  14. LABAKAWLBIXxx表示:

    lyrica 150 mg sale purchase pregabalin pill lyrica 75 mg pills

  15. XsaYrolLiZgt表示:

    On this site u can buy all known killa snus for very good price!

  16. Ginniepisn表示:

    premium essay writing service
    someone write my essay for me
    college application essay help online

  17. Ginniepisn表示:

    custom essay paper writing
    using essay writing service
    essay writing helper

  18. XsaYaylLiZgt表示:

    On this site u can buy all known KILLA COLD MINT for very good price!

  19. DABAKAWLBIXhp表示:

    order neurontin 100 mg brand neurontin 100 mg neurontin 100 mg brand

  20. DABAKAWLBIXxa表示:

    neurontin 100 mg tablet gabapentin 400 mg brand order gabapentin 100 mg pill

  21. lonpao表示:

    Great info! Keep post great articles.

  22. You write Formidable articles, keep up good work.

  23. alwaүs i used to read smaller articles oor reviews whiuch ɑlso clerar theiг motive, аnd that iss allso happening wіth thiѕ paragraph ԝhich Ι am reading now.

    Hеre is mmy webpage – beli followers tik tok murah

  24. I came across an article that talks about the same thing but even more and when you go deeper.

  25. Ginniepisn表示:

    essay writer reddit
    the best essay writers
    custom essay UK

  26. Ginniepisn表示:

    custom essay meister
    the best custom essay writing service
    academic essay writing service

  27. Hmm is anyone еlse encountering prooblems wih thee pictures оn this blog
    loading? I’m trʏing to find out іf its a proƅlem on my end or if it’s
    the blog. Αny responses wоuld be ɡreatly appreciated.

    Review mʏ website … resiko beli jam tayang youtube

  28. hellraiser表示:

    I think this is among the so much vital info for me. And i’m happy reading your article. But wanna remark on few common issues, The site style is wonderful, the articles is really excellent : D. Just right job, cheers

  29. VABAKAWLBIXjf表示:

    diovan 80 mg price cheap valsartan 160 mg order diovan 160 mg without prescription

  30. VABAKAWLBIXkt表示:

    valsartan 160 mg drug buy diovan 80 mg buy valsartan 80 mg for sale

發佈回覆給「resiko beli jam tayang youtube」的留言 取消回覆

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