How to suppress specific CSS 2.0 validation errors in Visual Studio 2008?
Tags: asp.net,visual-studio-2008,css
Problem :
A typical CSS property that I use often is overflow-x
or overflow-y
. Sometimes I use CSS 2.1 or later properties or selectors. These (correctly) raise a validation error:
Validation (CSS 2.0): 'overflow-y' is not a known CSS property name.
For years I ignored this, but it kinda feels wrong. It's possible to switch off warnings in C# and other languages for a particular line, block, file or project. Is something similar possible for CSS (or HTML) errors or warnings? Instead of switching it all off, I prefer a more granular solution.
Solution :
If you're willing to muck around a bit you can get exactly what you want.
- Go to Visual Studio folder \Common7\Packages\1033\schemas\CSS
- Copy css21.xml to css21mod.xml
Find the section:
<cssmd:property-def _locID="overflow" ...
After that section, insert:
<cssmd:property-def _locID="overflow-x" _locAttrData="description,syntax" type="enum" description="Visibility of content extending beyond element's dimensions in x" syntax="One of the overflow values | inherit" enum="inherit auto hidden scroll visible"/> <cssmd:property-def _locID="overflow-y" _locAttrData="description,syntax" type="enum" description="Visibility of content extending beyond element's dimensions in y" syntax="One of the overflow values | inherit" enum="inherit auto hidden scroll visible"/>
Open regedit, go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages\{A764E895-518D-11d2-9A89-00C04F79EFC3}\Schemas
If on 64-bit, you will have to go to
SOFTWARE\Wow6432Node\Microsoft
etcCreate a new key called
Schema 5
, and fill in the "File" and "Friendly Name" string values withcss21mod.xml
andCSS 2.1 (mod)
Should be all set!