Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent indent when formatting CSS

In Visual Studio 2013 when I format my CSS code (Ctrl+K+F) it will sometimes indent my CSS properties into a hierarchy.

For example:

.a { color:red; } .a .b {color:blue; } 

Becomes:

.a {   color:red; }     .a .b {      color:blue;    } 

When I would prefer:

.a {   color:red; }  .a .b {   color:blue; } 

Is there a way of modifying Visual Studio to prevent this indentation?

like image 293
Curtis Avatar asked Aug 20 '14 14:08

Curtis


People also ask

Does CSS care about indentation?

When writing CSS it's a really great idea to indent properties within a rule set. The indentation isn't for the browser—browser's don't care. The indentation is for us to help understand our code.

How do I beautify CSS in Visual Studio?

press F1 or ctrl+shift+p and then enter beautify ..

How do you indent text on a page in CSS?

How to Indent Text in CSS You can use the CSS text-indent property to indent text in any block container, including divs, headings, asides, articles, blockquotes, and list elements. Say you want to indent all div elements containing text on a page to the right by 50px. Then, using the CSS type selector div, set the text-indent property to 50px.

How to remove indentation from an unordered list using CSS?

To remove that indentation from an unordered list (a list having bullets) there needs styling to be done using CSS. The style will be implemented only on the list. So the selector would be ul. Example: This example creates a page with a list with zero (0) indent . In the above example, padding-left property is used to set the indentation from left.

How do you remove the indentation from left in HTML?

So the selector would be ul. Example: This example creates a page with a list with zero (0) indent . In the above example, padding-left property is used to set the indentation from left. The padding-left:0 is used to remove indentation (space) from left.

How do I indent text in an ordered list?

An ordered list element (<ol>) will indent its list items by default. If you’d like to change the indentation distance, then you can use CSS. In this case, you won’t use the text-indent property. Instead, you’ll use the margin-left or padding-left property.


1 Answers

Yes, you can set a preference for this from the Tools, Options menu.

Drill down in Text Editor to CSS, and under Advanced, turn Hierarchical Indentation off:

enter image description here

like image 50
Reg Edit Avatar answered Sep 22 '22 12:09

Reg Edit