How can I customize css formatting rules in html file (<style> tag) by VS Code's built-in css formatter?

104 Views Asked by At

How can I customize css formatting rules in html file (<style> tag) by VS Code's built-in css formatter?

  <style>
    body {
      max-width: 800px;
      margin: 0 auto;
    }

    p,
    li,
    dd,
    dt,
    address {
      line-height: 1.5;
    }
  </style>

I know that I can config like this, but is does not work for <style> tag in html file:

{
  // format
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true,
  // html
  "[html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  },
  // css
  "[css]": {
    "editor.defaultFormatter": "vscode.css-language-features"
  },
  "css.format.newlineBetweenSelectors": false,
  "css.format.spaceAroundSelectorSeparator": true,
}
0

There are 0 best solutions below