Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there #Region code for HTML

In VB and C# there are #Region ... #endRegion and have it collapsable. Is there a similar way to do this in HTML?

Right now I just have comments blocking where the different elements are on my HTML page, but I would like to have a single collapse point instead of all of the <tr> <td> and <div> tags collapsed.

like image 884
Jim Avatar asked Aug 19 '10 12:08

Jim


4 Answers

This indeed depends on the IDE, just noticed today that the newest version of the free Web Essentials 2012 plugin for Visual Studio has added region support in HTML.

http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6

http://vswebessentials.com/changelog

  <!--#region main  -->


  <!--#endregion -->
like image 87
BigBlondeViking Avatar answered Nov 13 '22 07:11

BigBlondeViking


As of Visual Studio 2013 Update 4 regions are now supported in the HTML editor. You may use the built in code snippet: type "

<!-- #region SampleRegion -->
<!-- #endregion -->

You can find the details of this improvement and other new features in update 4 here.

like image 26
Mauricio Aviles Avatar answered Nov 13 '22 07:11

Mauricio Aviles


I think the short answer is no.

Region is only a IDE directive recognised by the editor (Visual Studio). There is nothing in the HTML standard and anything you did put in the HTML would be sent straight down to the browser too, so I've not come across anything and can't imagine there would ever be anything.

like image 12
Paul Hadfield Avatar answered Nov 13 '22 06:11

Paul Hadfield


Highlight the section you want collapsed, then go to Edit -> Outlining -> Hide Selection

Reference: How to: Collapse and Expand HTML Elements in Visual Web Developer

Edit: This assumes you're using Visual Studio

like image 10
Ryan Kinal Avatar answered Nov 13 '22 07:11

Ryan Kinal