Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding url into <a href=""> with Emmet

Tags:

html

emmet

Has Emmet a syntax for adding URL into <a href=""> tag?

E.g.:

Syntax:

a:www.google.com

Result:

<a href="www.google.com"></a>
like image 910
Runtime Terror Avatar asked May 12 '16 10:05

Runtime Terror


People also ask

How do you do Emmet in HTML?

Wrap with Tags Just highlight the code that you want to wrap and open the command pallet ( F1 ). Then search for Emmet: Wrap with Abbreviation . You'll then be presented with a dialog box where you can type in the element. You can also use standard Emmet syntax in this dialog.

How do you add attributes to Emmet?

You can place as many attributes as you like inside square brackets. You don't have to specify attribute values: td[colspan title] will produce <td colspan="" title=""> with tabstops inside each empty attribute (if your editor supports them). You can use single or double quotes for quoting attribute values.

What is Emmet syntax?

Emmet uses a specific syntax in order to expand small snippets of code, similar to CSS selectors, into full-fledged HTML code. For example, the sequence. div#page>div.logo+ul#navigation>li*5>a. or. #page>.logo+ul#navigation>li*5>a.


1 Answers

The general syntax for adding an attribute to an element in Emmet is:

element[attr=value]

So in this case, it'd be:

a[href=www.google.com]

That said, if you just do a by itself, it should automatically jump the editor cursor into the href attribute, and you can do a:link to pre-populate it with a http://. So those options might be faster/more to your tastes.

For more information, look at the Emmet Cheat Sheet - it lists all the syntax that's available.

like image 144
Joe Clay Avatar answered Oct 06 '22 02:10

Joe Clay