CSS attribute selector for non-empty attributes

CssCss Selectors

Css Problem Overview


Is there a CSS selector that applies to non-empty attributes? Using :not([Data-Attribute='']) matches if the attribute is non-existing, too.

I'm looking for something like [Data-Attribute!=''].

Css Solutions


Solution 1 - Css

try this

<style>
    [Data-Attribute]:not([Data-Attribute=""])
    {
        background-color: Red;
    }
</style>

Solution 2 - Css

for style false support

[{ font: ["sofia", "slabo", "roboto", "inconsolata", "ubuntu", false] }]

.ql-snow .ql-picker.ql-font .ql-picker-item:not([data-value])::before {
content: "default";
font-family: none !important;}

.ql-snow .ql-picker.ql-font .ql-picker-label:not([data-value])::before {
content: "default";}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMR.ABCView Question on Stackoverflow
Solution 1 - Csssangram parmarView Answer on Stackoverflow
Solution 2 - CssSumit AsagaonkarView Answer on Stackoverflow