I\'m using bootstrap 5 with angular and I add style and script to angular.json but the problem in VS Code it does not recognize the bootstrap classes.
Install this extension https://marketplace.visualstudio.com/items?itemName=ecmel.vscode-html-css
Then in your .vscode/settings.json:
{
"css.styleSheets": [
"https://cdn.jsdelivr.net/npm/bootstrap@5.0.0beta1/dist/css/bootstrap.min.css"
]
}
Restart vscode. Worked for me.
As said by others, uninstall the HTML CSS Support then reload VS code. You can use IntelliSense for CSS class names in HTML if you want, it provides CSS class name completion for the HTML class attribute based on the definitions found in your workspace or external files referenced through the link element. And gives you autocompletion for CSS class definitions that can be found in your workspace (defined in CSS files or the in the file types listed in the Supported Language Modes section)
Downgrading the 'HTML CSS Support' extention to v1.3.3 will fix the problem.
Check if extension "HTML CSS Support" got auto-updated. If it did, then it will ask for reloading of VS Code. Do it. Had exactly same issue today.
That did not help.
Looks like the issue should have been solved with the next release of the extension, but still, some of the Problems are there. Check the github: https://github.com/ecmel/vscode-html-css/issues
In short, what you need to do is go to VS Code settings and switch from "User" to "Workspace". Then type "css settings" in settings search bar and open the exact same option under "Extensions". Click "CSS: Style Sheets", which will open settings.json for workspace and add your CSS files paths there. Hopefully it will solve all the Problems for you.
If you are using newer version of HTML CSS Support (>= 1.5.0), you can add the following css.validation
settings to your settings.json
which should clear this issue. Don't forget to reload VS Code after changing the settings though.