Reputation: 184
How to add a comment tag in HTML using Emmet in VSCode?
What I want: Before:
<div class='abc'>
After using Emmet keyboard shortcut:
<div class='abc'> <!-- -->
Upvotes: 5
Views: 6781
Reputation: 1
In VS Code, you can use the Emmet abbreviation <!--
to comment out HTML code. Here's how:
<!--
(start of comment)Tab
(or Enter
on some systems)-->
(end of comment)Alternatively, you can also use the keyboard shortcut:
Ctrl
+ Shift
+ 8
Cmd
+ Shift
+ 8
This will toggle commenting out the selected HTML code.
Note: Make sure you have Emmet installed and enabled in your VS Code settings. If you're not sure, you can check the VS Code documentation or install Emmet from the Extensions marketplace.
Upvotes: 0
Reputation: 791
There is a command called Emmet: Toggle Comment
which comments the current line. If you use the keybinding extenstion, it is configured as Cmd M + Cmd /
.
<title>Document</title>
->
<!-- <title>Document</title> -->
Upvotes: 1
Reputation: 1
On a mac - it is command+option+"right arrow" - allows you to place a comment on a line that already has content.
Upvotes: 0
Reputation: 2699
Emmet has built-in c
abbreviation which outputs comment
Upvotes: 13