1

Within Visual Studio Code 1.7.2, I am able to generate a quick list of HTML data with the following snippet, followed by pressing TAB...

ul>li*5>h3+div

That will generate this list...

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

But how can I prepopulate every <h3></h3> to say <h3>tite</h3>, and every <div></div> to say <div>content</div>?

1 Answer 1

1

VScode uses emmet for this, so the input text would be:

ul>li*5>h3{title}+div{content}

which will expand to:

<ul>
    <li>
        <h3>title</h3>
        <div>content</div>
    </li>
    <li>
        <h3>title</h3>
        <div>content</div>
    </li>
    <li>
        <h3>title</h3>
        <div>content</div>
    </li>
    <li>
        <h3>title</h3>
        <div>content</div>
    </li>
    <li>
        <h3>title</h3>
        <div>content</div>
    </li>
</ul>

Here's additional documentation of the Emmet abbreviation syntax

Sign up to request clarification or add additional context in comments.

1 Comment

Very nice. Thanks for the emmet information as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.