Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find closing HTML tag in Sublime Text

People also ask

How do you identify a closing tag?

An opening tag begins a section of page content, and a closing tag ends it. For example, to markup a section of text as a paragraph, you would open the paragraph with an opening paragraph tag <p> and close it with a closing paragraph tag </p> (closing tags always proceed the element with a /).

How do I exit find in Sublime Text?

For an auto-closing search box you can use incremental search ( Ctrl+I , or via Find tab in the menu). For navigating to next occurrences you may use find-next command ( F3 is the default key, or via Find tab in the menu). It is not exactly what you wished for, but it will get you much closer to that.

How do I automatically close a tag in Sublime Text?

To enable, add the following object to the array in the key binding file (Sublime Text > Preferences > Key Bindings). Show activity on this post. Not really the answer you want but if you type </ ST3 will auto complete the closest unclosed tag. Otherwise the auto complete answer by Nick is your best bet.

What is the syntax to show that a tag is a closing tag?

The '/' (forward slash) is used to represent the closing of a tag in HTML. In HTML5 it is not strictly necessary to close some HTML tags. For example - <img>, <link>, <meta>, etc. These tags do not require closing tags. Such tags that aren't required to have a closing tag are called the self-closing tag.


Try Emmet plug-in command Go To Matching Pair:

http://docs.emmet.io/actions/go-to-pair/

Shortcut (Mac): Shift + Control + T

Shortcut (PC): Control + Alt + J

https://github.com/sergeche/emmet-sublime#available-actions


There is a shortcut (Ctrl+Shift+A for Windows and Linux users, Command+Shift+A for Mac users) to select the whole block within the currently selected tag.

For example, if you pressed this while your text cursor was within the outer div tag in the code below, all the divs with class selected would be selected.

<div class='current_tag_block'>
  <div class='selected'></div>
  <div class='selected'></div>
  <div class='selected'></div>
  <div class='selected'></div>
</div>

As @frazer-kirkman mentioned in a comments you can also move your cursor to the start or to the end of the selected block by pressing either Left or Right button on a keyboard depending on your cursor's position


It's built in from Sublime Editor 2 at least. Just press the following and it balances the HTML-tag

Shortcut (Mac): Shift + Command + A

Shortcut (Windows): Control + Alt + A


Under the "Goto" menu, Control + M is Jump to Matching Bracket. Works for parentheses as well.


None of the above worked on Sublime Text 3 on Windows 10, Ctrl + Shift + ' with the Emmet Sublime Text 3 plugin works great and was the only working solution for me. Ctrl + Shift + T re-opens the last closed item and to my knowledge of Sublime, has done so since early builds of ST3 or late builds of ST2.


As said before, Control/Command + Shift + A gives you basic support for tag matching. Press it again to extend the match to the parent element. Press arrow left/right to jump to the start/end tag.

Anyway, there is no built-in highlighting of matching tags. Emmet is a popular plugin but it's overkill for this purpose and can get in the way if you don't want Emmet-like editing. Bracket Highlighter seems to be a better choice for this use case.