csseonasdan-datetimepickercsslint

Csslint in Visual Studio gives be an overqualified-elements warning


I have the eonasdan datetime picker installed on my project. It works fine, but I had a problem when used in a table as the headings took on the colours of the table headings. Using an answer to this question I used the following css to fix the problem

div.bootstrap-datetimepicker-widget table th {
    color: black;
    background-color: white;
}

It now looks like I think it should.

However, ever since I used it, I have been getting the warning

overqualified-elements  (CssLint) Element (div.bootstrap-datetimepicker-widget) is overqualified, just use .bootstrap-datetimepicker-widget without element name. 

When I remove the div the datepicker gets the table heading colour again.

I don't like to ignore warnings. Is the CSS correct and Visual Studio is just being a stupid robot, or do I need to look a bit closer at the CSS?

Edit: Should add, I'm running VS 2017 Community edition and .Net 4.7


Solution

  • You can use:

    .bootstrap-datetimepicker-widget table tr th {
        color: black;
        background-color: white;
    }
    

    instead of div.bootstrap-datetimepicker-widget table th. This way you will remove the div whose CSS Lint is complaining about, keeping the desired output (black text inside component).