How do you enable error detection for CSS files in Visual Studio 2010?
How do you enable error dectection for CSS files in Visual Studio 2010? It's said to be in tools o开发者_运维知识库ptions, but I can't seem to find it.
- In Visual Studio, open the Tools menu and select Options
- Expand the Text Editor group, then the CSS group.
- Click on Miscellaneous and you'll see the option to enable Detect Errors there.
Make sure in Visual Studio 2010 IDE> View>Toolbars>Stylesheet is checked to show Stylesheet toolbar.
IDE will indicate errors in two ways.
01) most importantly don't forget VS Error List window.It will show css errors in warnings section.you can then navigate to error by double clicking the error itself through the window.
02) it will show squiglies in erroneous CSS styles
Not sure if this is what you're asking for, but Visual Studio comes with a few CSS validation templates. If you select from the top menu View > Toolbars > Style Sheet, you'll see a little dropdown in the top toolbar. My VS 2010 lets me choose "Internet Explorer 6.0, CSS 1.0, CSS 2.0 and CSS 2.1"
If you write a property that's not valid for the currently selected CSS version, Visual Studio will put a little green line underneath it and complain about it not being a known CSS property etc.
This happened to me and CTRL+K+D gave me that same error even when detection was on. The solution was to look in the 'Errors' tab in Studio and to look at just the warnings. Scroll down to the CSS file related issues and low and behold your syntax error will be listed there.
Mine turned out to be two semi-colons ';;'
Hope this helps anyone else :)
精彩评论