Search code examples
cssvisual-studio-2010

Regions in CSS like C# regions?


Is there a way to define regions in CSS file just like regions in C#?

Like in C# you define regions as follows

#region My Region
//your code here
#endregion

My problem is I don't want to use separate CSS files for my asp.net project but I also want to organinze so I can define specific sections like one for Master Page CSS and one for FormUser and so forth so it is easy to troubleshoot when needed. Is it possible?


Solution

  • You can use this for regions...works well to make collapsible regions

    /*#region RegionName*/
    
    /*#endregion RegionName*/
    

    The RegionName is optional in endregion, you can also use

    /*#region RegionName*/
    
    /*#endregion */
    

    Shortcut in VS2015 onwards for this Type region, [Esc], [Tab]. Credits for shortcut to Dush.