Search code examples
htmlvisual-studio-code

How to wrap a text with class?


After I type my text, I want to wrap <p class="content"> Lorem ipsum </p> at VS Code. If I don't need to emmet with a class, I'm using Emmet: Wrap with Abbreviation command but it is not work with addition class my p element. It wraps my content with a <class> Lorem ipsum </class> instead. So how can I wrap how I want?


Solution

  • You need to write your text, then:

    1. press cmd+shift+p or f1 directly
    2. type Emmet: Wrap with abbreviation
    3. then select your tag, (p, div, etc.)

    To add class, type .dot before class name, [] square brackets to add attributes

    An example I tested: div.textWrapper>p.textContent[style="color: red"]