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...

17,497 Responses

  1. Robertdar表示:

    Groundbreaking telescope reveals first piece of new cosmic map
    [url=https://kr13at.cc]kra at[/url]
    Greetings, earthlings! I’m Jackie Wattles, and I’m thrilled to be a new name bringing awe to your inbox.

    I’ve covered space exploration for nearly a decade at CNN, and there has never been a more exciting time to follow space and science discoveries. As researchers push forward to explore and understand the cosmos, advancements in technology are sparking rapid developments in rocketry, astronomical observatories and a multitude of scientific instruments.

    Look no further than the missions racing to unlock dark matter and the mysterious force known as dark energy, both so named precisely because science has yet to explain these phenomena.
    https://kr13at.cc
    кракен даркнет
    Astronomers have never detected dark matter, but they believe it makes up about 85% of the total matter in the universe. Meanwhile, the existence of dark energy helps researchers explain why the universe is expanding — and why that expansion is speeding up.
    Extraordinary new scientific instruments are churning out trailblazing data, ready to reshape how scientists view the cosmos.

    A prime example is the European Space Agency’s wide-angle Euclid telescope that launched in 2023 to investigate the riddles of dark energy and dark matter.

    Euclid this week delivered the first piece of a cosmic map — containing about 100 million stars and galaxies — that will take six years to create.

    These stunning 3D observations may help scientists see how dark matter warps light and curves space across galaxies.

    Meanwhile, on a mountaintop in northern Chile, the US National Science Foundation and Stanford University researchers are preparing to power up the world’s largest digital camera inside the Vera C. Rubin Observatory.

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

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

  4. Gibkiy_jwPi表示:

    по доступной стоимости
    самоклеющийся багет https://elastichnyj-plintus.ru/ .

  5. DarioTob表示:

    пин ап казино официальный сайт: пин ап казино официальный сайт – pinup

  6. Финансовый маркетплейс для жителей Казахстана предлагает удобный способ подбора кредитов, ипотеки, микрозаймов и других финансовых продуктов. На сайте собраны лучшие предложения от надежных банков и МФО.

    МФО Казахстана Ипотека .

  7. Gibkiy_buPi表示:

    клейкий профиль для стен
    гибкий самоклеящийся плинтус https://elastichnyj-plintus.ru/ .

  8. Patrickmoons表示:

    Trump’s call for a protest crackdown has been a boon for Chinese propaganda
    Analysis by CNN’s James Griffiths
    Protesters running amok. Innocent citizens under siege. Outside actors engaging in terrorist acts. Police struggling to maintain control and in desperate need of reinforcements.
    [url=https://kra18-at.cc]kra9.at[/url]
    That was how Chinese state media portrayed anti-government protests in Hong Kong last year, dismissing calls for greater democracy and an investigation into police brutality by focusing on individual acts of violence and property damage.
    [url=https://kra18-at.cc]kraken3yvbvzmhytnrnuhsy772i6dfobofu652e27f5hx6y5cpj7rgyd[/url]
    Throughout the protests, the US was consistent in its support of people’s right to take to the streets and have their voice heard. Facing widespread unrest and public anger at home in the wake of the death of George Floyd, the reaction from US President Donald Trump appeared markedly different.
    [url=https://kra18-at.cc]kraken2trfqodidvlh4aa337cpzfrhdlfldhve5nf7njhumwr7instad.onion[/url]
    On Monday, Trump called for the military to be deployed to “dominate” protesters, and demanded states do more to stem “acts of domestic terror.”
    [url=https://kra18-at.cc]kra15.gl[/url]
    The irony has not been lost on Beijing, which on Thursday marks (or rather doesn’t, the date is highly censored) its own military crackdown on anti-government protesters on June 4, 1989.
    [url=https://kra18-at.cc]kraken сайт[/url]
    “Washington’s promise of equality and justice for all in the country has remained hollow at best,” state news agency Xinhua said in a commentary titled “The coming suffocation of the American dream.”

    “Amid the ongoing anti-racism protests in the country, decision-makers in Washington, instead of trying to sooth the pain and anger of the public, have been fanning the flames, calling protesters ‘THUGS,’ and threatening them with ‘the most vicious dogs, and most ominous weapons,” the commentary said.
    kra18
    https://kra18-at.cc
    China Daily, a state-backed newspaper, noted that “The US, after the killing of Floyd, seems to be on fire, and troops have been mobilized to subdue angry demonstrators.”

    “This is certainly not what the world expects to see in a country that is the world’s sole superpower,” it added. “But that sadly is the reality of the US.”

    This rhetoric isn’t just embarrassing for Washington, it’s also a sign of how the US may find its influence damaged by a perceived hypocrisy over human rights at home and abroad.

    Earlier today, Hong Kong’s leader Carrie Lam pointed to the unrest in the US as evidence of Washington’s “double standards.”

    “They attach great importance to the national security of their country, but look at our national security through tinted spectacles, especially the current situation in Hong Kong,” she added.

    The ability of Washington to influence Beijing’s position on Hong Kong – which is in part founded on fear of outside influence in the city – was already severely limited. The Trump administration’s reaction to protests at home may have hurt its position even further.

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

  10. DarioTob表示:

    пин ап вход: пин ап вход – pinup-kazi.ru

  11. CurtisIncix表示:

    pinup: пин ап вход – пинап казино

  12. Платформа позволяет узнать, какие банки предлагают самые выгодные условия для ипотеки. Сравните ставки, сроки и дополнительные бонусы.

    МФО Казахстана Ипотека .

發佈留言

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