What is the equivalent of the '.' CSS selector for any attribute?What are valid values for the id attribute in HTML?Set cellpadding and cellspacing in CSS?How can I know which radio button is selected via jQuery?Is there a CSS parent selector?Is there a “previous sibling” selector?Change an HTML5 input's placeholder color with CSSCSS selector for first element with classHow to create an HTML button that acts like a link?How can I set the default value for an HTML <select> element?Can I write a CSS selector selecting elements NOT having a certain class?

Set theory with antielements?

What is the question mark?

100 Years of GCHQ - A quick afternoon puzzle!

Typesetting "hollow slash"

Quick destruction of a helium filled airship?

Adding things to bunches of things vs multiplication

Can anybody tell me who this Pokemon is?

Scam? Phone call from "Department of Social Security" asking me to call back

Why does auto deduce this variable as double and not float?

Has the speed of light ever been measured in vacuum?

Can I use my OWN published papers' images in my thesis without Copyright infringment

What are these panels underneath the wing root of a A380?

Doesn't the speed of light limit imply the same electron can be annihilated twice?

Why does Japan use the same type of AC power outlet as the US?

What would cause a nuclear power plant to break down after 2000 years, but not sooner?

Insert or push_back to end of a std::vector?

How do I ask for 2-3 days per week remote work in a job interview?

6502: is BCD *fundamentally* the same performance as non-BCD?

What are some tips and tricks for finding the cheapest flight when luggage and other fees are not revealed until far into the booking process?

Unconventional examples of mathematical modelling

Would molten tin solidify and coat an organic horn?

What is the spellcasting ability of a Barbarian Totem Warrior?

How do ultra-stable oscillators for spacecraft work?

Duplicate and slide edge (rip from boundary)



What is the equivalent of the '.' CSS selector for any attribute?


What are valid values for the id attribute in HTML?Set cellpadding and cellspacing in CSS?How can I know which radio button is selected via jQuery?Is there a CSS parent selector?Is there a “previous sibling” selector?Change an HTML5 input's placeholder color with CSSCSS selector for first element with classHow to create an HTML button that acts like a link?How can I set the default value for an HTML <select> element?Can I write a CSS selector selecting elements NOT having a certain class?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'd like to select things similarly to how classes are selected (but I would like to use other attributes). In the same way that class='item-button item-button-selected' can be selected with both .item-button and .item-button-selected.










share|improve this question
































    2















    I'd like to select things similarly to how classes are selected (but I would like to use other attributes). In the same way that class='item-button item-button-selected' can be selected with both .item-button and .item-button-selected.










    share|improve this question




























      2












      2








      2








      I'd like to select things similarly to how classes are selected (but I would like to use other attributes). In the same way that class='item-button item-button-selected' can be selected with both .item-button and .item-button-selected.










      share|improve this question
















      I'd like to select things similarly to how classes are selected (but I would like to use other attributes). In the same way that class='item-button item-button-selected' can be selected with both .item-button and .item-button-selected.







      html css-selectors






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 3:51









      BoltClock

      546k133 gold badges1200 silver badges1227 bronze badges




      546k133 gold badges1200 silver badges1227 bronze badges










      asked Mar 27 at 12:33









      faissaloofaissaloo

      5054 silver badges17 bronze badges




      5054 silver badges17 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          2














          The equivalent of an HTML class selector for any attribute is [attribute~=value], matching one of a set of space-separated values:






          [data-foo~="a"] 
          color: red;


          [data-foo~="a"][data-foo~="b"]
          color: blue;

          <p data-foo="a">a
          <p data-foo="a b">a b
          <p data-foo="b">b





          In case you're worried about specificity (if this is a non-CSS use case, you don't need to worry), attribute selectors and class selectors are equally specific.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377317%2fwhat-is-the-equivalent-of-the-css-selector-for-any-attribute%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            The equivalent of an HTML class selector for any attribute is [attribute~=value], matching one of a set of space-separated values:






            [data-foo~="a"] 
            color: red;


            [data-foo~="a"][data-foo~="b"]
            color: blue;

            <p data-foo="a">a
            <p data-foo="a b">a b
            <p data-foo="b">b





            In case you're worried about specificity (if this is a non-CSS use case, you don't need to worry), attribute selectors and class selectors are equally specific.






            share|improve this answer





























              2














              The equivalent of an HTML class selector for any attribute is [attribute~=value], matching one of a set of space-separated values:






              [data-foo~="a"] 
              color: red;


              [data-foo~="a"][data-foo~="b"]
              color: blue;

              <p data-foo="a">a
              <p data-foo="a b">a b
              <p data-foo="b">b





              In case you're worried about specificity (if this is a non-CSS use case, you don't need to worry), attribute selectors and class selectors are equally specific.






              share|improve this answer



























                2












                2








                2







                The equivalent of an HTML class selector for any attribute is [attribute~=value], matching one of a set of space-separated values:






                [data-foo~="a"] 
                color: red;


                [data-foo~="a"][data-foo~="b"]
                color: blue;

                <p data-foo="a">a
                <p data-foo="a b">a b
                <p data-foo="b">b





                In case you're worried about specificity (if this is a non-CSS use case, you don't need to worry), attribute selectors and class selectors are equally specific.






                share|improve this answer













                The equivalent of an HTML class selector for any attribute is [attribute~=value], matching one of a set of space-separated values:






                [data-foo~="a"] 
                color: red;


                [data-foo~="a"][data-foo~="b"]
                color: blue;

                <p data-foo="a">a
                <p data-foo="a b">a b
                <p data-foo="b">b





                In case you're worried about specificity (if this is a non-CSS use case, you don't need to worry), attribute selectors and class selectors are equally specific.






                [data-foo~="a"] 
                color: red;


                [data-foo~="a"][data-foo~="b"]
                color: blue;

                <p data-foo="a">a
                <p data-foo="a b">a b
                <p data-foo="b">b





                [data-foo~="a"] 
                color: red;


                [data-foo~="a"][data-foo~="b"]
                color: blue;

                <p data-foo="a">a
                <p data-foo="a b">a b
                <p data-foo="b">b






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 28 at 3:40









                BoltClockBoltClock

                546k133 gold badges1200 silver badges1227 bronze badges




                546k133 gold badges1200 silver badges1227 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377317%2fwhat-is-the-equivalent-of-the-css-selector-for-any-attribute%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript