How to suppress specific CSS 2.0 validation errors in Visual Studio 2008?


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.

  1. Go to Visual Studio folder \Common7\Packages\1033\schemas\CSS
  2. Copy css21.xml to css21mod.xml
  3. Find the section:

    <cssmd:property-def _locID="overflow" ...
  4. After that section, insert:

        _locID="overflow-x" _locAttrData="description,syntax" 
        description="Visibility of content extending beyond element's dimensions in x"
        syntax="One of the overflow values | inherit" 
        enum="inherit auto hidden scroll visible"/>
        _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"/>
  5. 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 etc

  6. Create a new key called Schema 5, and fill in the "File" and "Friendly Name" string values with css21mod.xml and CSS 2.1 (mod)

Should be all set!

    CSS Howto..

    multiple “HTML” tags in HTML file: how to separate CSS rules when classes and id's can be the same?

    CSS: how to remove the top-gap for sub-menus?

    Polymer 1.0 how can I style a paper-input:disabled?

    How can I use jQuery to hide or show table rows based on role?

    how to change the background color of first row in html table and all other rows alternate color

    How to get css div to stretch to 100% of window

    Chrome doesn't show the favicon

    CSS: How to align text to baseline of height-adjusted input element?

    How can a div be aligned center using jquery [closed]

    css How can I make the page body stay the same size even if I add element to it?

    How to put a border around the text in a button?

    How can I have a transparent overlay and center with flex box?

    How to change color icon in Materialize?

    How to convert UPPERCASE text to Title Case using CSS

    css/javascript - How to achieve these unusual design requirements? [closed]

    How to have different layout orders for same html code for desktop and desktop using css or javascript (not jquery)

    Show/hide rows based on class in HTML

    How to prevent iOS keyboard from pushing the view off screen with CSS or JS

    CSS- How'd they do that without Absolute Positioning and Z-index?

    How to set jquery ui icon as background image per css?

    How do I remove the side padding in the following case?

    CSS: How to achieve - Two elements to be centered and positioned side by side WITHOUT a third parent container?

    How to position a div in the absolute center of a page?

    How to insert line breaks between numbers and content in ordered list

    how to obtain proper alignment of tables on top of each other with horizontal scrollbar at bottom

    Different JEditorPanes show html content, using the same css rules

    How do I translate an image based on its height?

    How should I crop the image at client side using jcrop and upload it?

    How do I set the height of a parent to auto minus pixels?

    how to make form input in middle