skip to Main Content

When I open the curly brackets in CSS and hit enter, it just jumps to the next line like this:

body {
}

It doesn’t add a new line with an indentation like it used to, I tried looking through the setting and trying everything but couldn’t get a result.
I want it to look like this when I press Enter:

body {
    
}

3

Answers


  1. Chosen as BEST ANSWER

    To anyone who is facing this problem in VSCode. This feature is not related to any extension, not Prettier or any other extension. What you have to do to fix this bug is:

    1. Go to the settings
    2. Search for Folding Strategy and choose the Auto option
    3. Then enable Folding

    It adds that indentation in both HTML and CSS

    enter image description here


  2. What you need is a VSCode plugin called "Prettier".

    It can be downloaded in the "Extensions" section of VSCode,
    or downloaded from this link: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode

    Login or Signup to reply.
  3. You can try the following:

    1. Check if you have set your default formatter to prettier
    2. You can check the box to Format On Save or ;
    3. Autosave: There are are currently 4 options available -:

    a) off

    b) afterDelay

    c) onFocusChange

    d) onWindowChange

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search