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?
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.
press F1 or ctrl+shift+p and then enter beautify ..
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.
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.
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.
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.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With