category | cover | created | tags | title |
---|---|---|---|---|
Tip |
/assets/tips/fold-css.png |
2021-05-12 |
CSS, Visual Studio Code |
Fold CSS declarations with region markers |
In Visual Studio Code, we can make given CSS declarations foldable with the region markers.
Just wrap the declarations between /*#region*/
and /*#endregion*/
if you're using CSS, SCSS or Less.
SCSS and Less also accept //
as a valid CSS comment, hence you can use // #region
and // #endregion
in the SCSS/Less files.
/* === Header === */
/* #region */
/* The CSS styles for header go here */
/* #endregion */
/* === Footer === */
/* #region */
/* The CSS styles for footer go here */
/* #endregion */
/* === Responsive === */
/* #region */
/* The responsive styles go here */
/* #endregion */
The following screenshot is an example: