CSS selector for attribute names based on a wildcardUniversal CSS selector to match any and all HTML data-* attributesSelect elements by data * attribute in CSSTarget all data attributes that starts withMatching attribute name ending by string in CSSSelect node by attribute value without nameQuery all elements with wildcard attribute selector (value does not matter) - javascriptquerySelector, get elements whose attribute begins with given stringWildcards in jQuery attribute's name selector?Set cellpadding and cellspacing in CSS?Which characters are valid in CSS class names/selectors?Is there a CSS parent selector?Is there a “previous sibling” CSS selector?Managing CSS ExplosionChange an HTML5 input's placeholder color with CSSCSS selector for first element with classHow can I transition height: 0; to height: auto; using CSS?How do CSS triangles work?Is it possible to apply CSS to half of a character?

What's the big deal about the Nazgûl losing their horses?

How to supply water to a coastal desert town with no rain and no freshwater aquifers?

Why is there paternal, for fatherly, fraternal, for brotherly, but no similar word for sons?

Do I need to be legally qualified to install a Hive smart thermostat?

What/Where usage English vs Japanese

Has there ever been a cold war other than between the U.S. and the U.S.S.R.?

What is the name of the technique when an element is repeated at different scales?

Should I hide my travel history to the UK when I apply for an Australian visa?

Contributing to a candidate as a Foreign National US Resident?

Why would "dead languages" be the only languages that spells could be written in?

How frequently do Russian people still refer to others by their patronymic (отчество)?

Advice for making/keeping shredded chicken moist?

Milky way is orbiting around?

How to deal with a Murder Hobo Paladin?

PhD: When to quit and move on?

Minimizing medical costs with HSA

How to respond to someone who condemns behavior similar to what they exhibit?

Why do Klingons use cloaking devices?

How would an Amulet of Proof Against Detection and Location interact with the Comprehend Languages spell?

Park the computer

Motorcyle Chain needs to be cleaned every time you lube it?

Is there a typical layout to blocking installed for backing in new construction framing?

How did שְׁלֹמֹה (shlomo) become Solomon?

Should I warn my boss I might take sick leave



CSS selector for attribute names based on a wildcard


Universal CSS selector to match any and all HTML data-* attributesSelect elements by data * attribute in CSSTarget all data attributes that starts withMatching attribute name ending by string in CSSSelect node by attribute value without nameQuery all elements with wildcard attribute selector (value does not matter) - javascriptquerySelector, get elements whose attribute begins with given stringWildcards in jQuery attribute's name selector?Set cellpadding and cellspacing in CSS?Which characters are valid in CSS class names/selectors?Is there a CSS parent selector?Is there a “previous sibling” CSS selector?Managing CSS ExplosionChange an HTML5 input's placeholder color with CSSCSS selector for first element with classHow can I transition height: 0; to height: auto; using CSS?How do CSS triangles work?Is it possible to apply CSS to half of a character?






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








14















I've recently been doing a little studying on CSS selectors and have run into a question regarding the new "data-*" attributes.



I understand that in order to select elements with a data attribute there are a few ways of going about it:



[data-something='value']... // data-something has value = 'value'
[data-something^='value']... // data-something has value that STARTS with 'value'
[data-something*='value']... // data-something has value with 'value SOMEWHERE in it


There are other variations of these, but my question pertains to CSS selectors that can target elements that simply HAVE a "data" attribute. More specifically, is there a CSS selector that can target elements that have ANY "data" attribute at all?



While incorrect, I'm thinking of something like:



[data]...


I've been searching through Google but haven't found anything regarding a generic selector for the attribute yet.










share|improve this question



















  • 7





    It would be cool if you could do something like [data-*]..

    – Josh Crozier
    Jan 19 '14 at 20:43











  • Are you using vanilla CSS or are you using some kind of pre-compiler like LESS, Stylus, etc...?

    – arb
    Jan 19 '14 at 20:45











  • I figured there would be a way of imitating this behavior in SASS or LESS, but I've only been looking for a vanilla CSS method so far.

    – Shawn Taylor
    Jan 19 '14 at 20:46











  • I am pretty sure this is impossible with just CSS, you could however add JavaScript to dynamically add a class to all elements that have data-* attrinutes. Just out of curiosity: why would you want to do that?

    – Cu3PO42
    Jan 19 '14 at 20:48






  • 2





    @Zero21xxx I don't think a preprocessor would help here, because a preprocessor ultimately doesn't extend the capabilities of CSS, it just makes writing it easier. There is in infinite number of possible data attributes, so you can't specify them all, unless you know exactly which ones may occur.

    – Cu3PO42
    Jan 19 '14 at 20:50

















14















I've recently been doing a little studying on CSS selectors and have run into a question regarding the new "data-*" attributes.



I understand that in order to select elements with a data attribute there are a few ways of going about it:



[data-something='value']... // data-something has value = 'value'
[data-something^='value']... // data-something has value that STARTS with 'value'
[data-something*='value']... // data-something has value with 'value SOMEWHERE in it


There are other variations of these, but my question pertains to CSS selectors that can target elements that simply HAVE a "data" attribute. More specifically, is there a CSS selector that can target elements that have ANY "data" attribute at all?



While incorrect, I'm thinking of something like:



[data]...


I've been searching through Google but haven't found anything regarding a generic selector for the attribute yet.










share|improve this question



















  • 7





    It would be cool if you could do something like [data-*]..

    – Josh Crozier
    Jan 19 '14 at 20:43











  • Are you using vanilla CSS or are you using some kind of pre-compiler like LESS, Stylus, etc...?

    – arb
    Jan 19 '14 at 20:45











  • I figured there would be a way of imitating this behavior in SASS or LESS, but I've only been looking for a vanilla CSS method so far.

    – Shawn Taylor
    Jan 19 '14 at 20:46











  • I am pretty sure this is impossible with just CSS, you could however add JavaScript to dynamically add a class to all elements that have data-* attrinutes. Just out of curiosity: why would you want to do that?

    – Cu3PO42
    Jan 19 '14 at 20:48






  • 2





    @Zero21xxx I don't think a preprocessor would help here, because a preprocessor ultimately doesn't extend the capabilities of CSS, it just makes writing it easier. There is in infinite number of possible data attributes, so you can't specify them all, unless you know exactly which ones may occur.

    – Cu3PO42
    Jan 19 '14 at 20:50













14












14








14


3






I've recently been doing a little studying on CSS selectors and have run into a question regarding the new "data-*" attributes.



I understand that in order to select elements with a data attribute there are a few ways of going about it:



[data-something='value']... // data-something has value = 'value'
[data-something^='value']... // data-something has value that STARTS with 'value'
[data-something*='value']... // data-something has value with 'value SOMEWHERE in it


There are other variations of these, but my question pertains to CSS selectors that can target elements that simply HAVE a "data" attribute. More specifically, is there a CSS selector that can target elements that have ANY "data" attribute at all?



While incorrect, I'm thinking of something like:



[data]...


I've been searching through Google but haven't found anything regarding a generic selector for the attribute yet.










share|improve this question
















I've recently been doing a little studying on CSS selectors and have run into a question regarding the new "data-*" attributes.



I understand that in order to select elements with a data attribute there are a few ways of going about it:



[data-something='value']... // data-something has value = 'value'
[data-something^='value']... // data-something has value that STARTS with 'value'
[data-something*='value']... // data-something has value with 'value SOMEWHERE in it


There are other variations of these, but my question pertains to CSS selectors that can target elements that simply HAVE a "data" attribute. More specifically, is there a CSS selector that can target elements that have ANY "data" attribute at all?



While incorrect, I'm thinking of something like:



[data]...


I've been searching through Google but haven't found anything regarding a generic selector for the attribute yet.







css css3 css-selectors attributes






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 20 '18 at 16:36









TylerH

16.3k10 gold badges56 silver badges71 bronze badges




16.3k10 gold badges56 silver badges71 bronze badges










asked Jan 19 '14 at 20:42









Shawn TaylorShawn Taylor

6112 gold badges20 silver badges35 bronze badges




6112 gold badges20 silver badges35 bronze badges







  • 7





    It would be cool if you could do something like [data-*]..

    – Josh Crozier
    Jan 19 '14 at 20:43











  • Are you using vanilla CSS or are you using some kind of pre-compiler like LESS, Stylus, etc...?

    – arb
    Jan 19 '14 at 20:45











  • I figured there would be a way of imitating this behavior in SASS or LESS, but I've only been looking for a vanilla CSS method so far.

    – Shawn Taylor
    Jan 19 '14 at 20:46











  • I am pretty sure this is impossible with just CSS, you could however add JavaScript to dynamically add a class to all elements that have data-* attrinutes. Just out of curiosity: why would you want to do that?

    – Cu3PO42
    Jan 19 '14 at 20:48






  • 2





    @Zero21xxx I don't think a preprocessor would help here, because a preprocessor ultimately doesn't extend the capabilities of CSS, it just makes writing it easier. There is in infinite number of possible data attributes, so you can't specify them all, unless you know exactly which ones may occur.

    – Cu3PO42
    Jan 19 '14 at 20:50












  • 7





    It would be cool if you could do something like [data-*]..

    – Josh Crozier
    Jan 19 '14 at 20:43











  • Are you using vanilla CSS or are you using some kind of pre-compiler like LESS, Stylus, etc...?

    – arb
    Jan 19 '14 at 20:45











  • I figured there would be a way of imitating this behavior in SASS or LESS, but I've only been looking for a vanilla CSS method so far.

    – Shawn Taylor
    Jan 19 '14 at 20:46











  • I am pretty sure this is impossible with just CSS, you could however add JavaScript to dynamically add a class to all elements that have data-* attrinutes. Just out of curiosity: why would you want to do that?

    – Cu3PO42
    Jan 19 '14 at 20:48






  • 2





    @Zero21xxx I don't think a preprocessor would help here, because a preprocessor ultimately doesn't extend the capabilities of CSS, it just makes writing it easier. There is in infinite number of possible data attributes, so you can't specify them all, unless you know exactly which ones may occur.

    – Cu3PO42
    Jan 19 '14 at 20:50







7




7





It would be cool if you could do something like [data-*]..

– Josh Crozier
Jan 19 '14 at 20:43





It would be cool if you could do something like [data-*]..

– Josh Crozier
Jan 19 '14 at 20:43













Are you using vanilla CSS or are you using some kind of pre-compiler like LESS, Stylus, etc...?

– arb
Jan 19 '14 at 20:45





Are you using vanilla CSS or are you using some kind of pre-compiler like LESS, Stylus, etc...?

– arb
Jan 19 '14 at 20:45













I figured there would be a way of imitating this behavior in SASS or LESS, but I've only been looking for a vanilla CSS method so far.

– Shawn Taylor
Jan 19 '14 at 20:46





I figured there would be a way of imitating this behavior in SASS or LESS, but I've only been looking for a vanilla CSS method so far.

– Shawn Taylor
Jan 19 '14 at 20:46













I am pretty sure this is impossible with just CSS, you could however add JavaScript to dynamically add a class to all elements that have data-* attrinutes. Just out of curiosity: why would you want to do that?

– Cu3PO42
Jan 19 '14 at 20:48





I am pretty sure this is impossible with just CSS, you could however add JavaScript to dynamically add a class to all elements that have data-* attrinutes. Just out of curiosity: why would you want to do that?

– Cu3PO42
Jan 19 '14 at 20:48




2




2





@Zero21xxx I don't think a preprocessor would help here, because a preprocessor ultimately doesn't extend the capabilities of CSS, it just makes writing it easier. There is in infinite number of possible data attributes, so you can't specify them all, unless you know exactly which ones may occur.

– Cu3PO42
Jan 19 '14 at 20:50





@Zero21xxx I don't think a preprocessor would help here, because a preprocessor ultimately doesn't extend the capabilities of CSS, it just makes writing it easier. There is in infinite number of possible data attributes, so you can't specify them all, unless you know exactly which ones may occur.

– Cu3PO42
Jan 19 '14 at 20:50












3 Answers
3






active

oldest

votes


















7














No, there is no wildcarding for attribute names in CSS selectors. All attribute selectors contrain a specific name of an attribute.






share|improve this answer























  • Why does this work then? jsfiddle.net/TylerH/5ho9yskc/2

    – TylerH
    Sep 20 '18 at 16:38






  • 1





    Because the original question requires the wildcard to work on the attribute itself. For instance, a CSS rule that aims to style all attributes that begin with [custom-] - where the asterisk () represents the wildcard. This is not possible.

    – CodeUK
    Oct 6 '18 at 23:04



















12














As you have pointed out, there are multiple ways to target the value of an HTML attribute.





  • E[foo="bar"]



    an E element whose "foo" attribute value is exactly
    equal to "bar"





  • E[foo~="bar"]



    an E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar"





  • E[foo^="bar"]



    an E element whose "foo" attribute value begins exactly with the string "bar"





  • E[foo$="bar"]



    an E element whose "foo" attribute value ends exactly with the string "bar"





  • E[foo*="bar"]



    an E element whose "foo" attribute value contains the substring "bar"





  • E[foo|="en"]



    an E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en"





But there is only one way to target the attribute name itself:





  • E[foo]



    an E element with a "foo" attribute





Hence, there are currently no methods for wildcarding attribute names:



div[data-*] ... /* may be useful, but doesn't exist */
div[data-^] ... /* may be useful, but doesn't exist */


source: W3C Selectors Level 3 Specification




From another answer to a similar question:




There is a recent
thread
in the www-style@w3.org mailing list, where Simon Pieters from Opera
has proposed a nice possible
syntax
that has got some acceptance in the thread, so there is a chance that
it will become standard somewhen in the future:



x-admin-* ... 
[data-my-*] ...






share|improve this answer




















  • 1





    Thank you for enlisting all the possibilities on how wild-card matching works for the values of CSS attributes. It really helped understand OP's question better.

    – RBT
    Jun 20 '17 at 8:25


















-2














YES, you can select all elements that have any value of a specified attribute:



[type] selects all elements that have a type="anything". attribute






share|improve this answer

























  • This is actually correct; I'm not sure why it is downvoted. (see jsfiddle.net/TylerH/5ho9yskc/1)

    – TylerH
    Sep 20 '18 at 16:35







  • 1





    It's rightly downvoted because it is not answering the question about wildcard attribute name.

    – Asaf Agranat
    Dec 9 '18 at 16:00













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%2f21222375%2fcss-selector-for-attribute-names-based-on-a-wildcard%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














No, there is no wildcarding for attribute names in CSS selectors. All attribute selectors contrain a specific name of an attribute.






share|improve this answer























  • Why does this work then? jsfiddle.net/TylerH/5ho9yskc/2

    – TylerH
    Sep 20 '18 at 16:38






  • 1





    Because the original question requires the wildcard to work on the attribute itself. For instance, a CSS rule that aims to style all attributes that begin with [custom-] - where the asterisk () represents the wildcard. This is not possible.

    – CodeUK
    Oct 6 '18 at 23:04
















7














No, there is no wildcarding for attribute names in CSS selectors. All attribute selectors contrain a specific name of an attribute.






share|improve this answer























  • Why does this work then? jsfiddle.net/TylerH/5ho9yskc/2

    – TylerH
    Sep 20 '18 at 16:38






  • 1





    Because the original question requires the wildcard to work on the attribute itself. For instance, a CSS rule that aims to style all attributes that begin with [custom-] - where the asterisk () represents the wildcard. This is not possible.

    – CodeUK
    Oct 6 '18 at 23:04














7












7








7







No, there is no wildcarding for attribute names in CSS selectors. All attribute selectors contrain a specific name of an attribute.






share|improve this answer













No, there is no wildcarding for attribute names in CSS selectors. All attribute selectors contrain a specific name of an attribute.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 19 '14 at 21:15









Jukka K. KorpelaJukka K. Korpela

156k25 gold badges199 silver badges300 bronze badges




156k25 gold badges199 silver badges300 bronze badges












  • Why does this work then? jsfiddle.net/TylerH/5ho9yskc/2

    – TylerH
    Sep 20 '18 at 16:38






  • 1





    Because the original question requires the wildcard to work on the attribute itself. For instance, a CSS rule that aims to style all attributes that begin with [custom-] - where the asterisk () represents the wildcard. This is not possible.

    – CodeUK
    Oct 6 '18 at 23:04


















  • Why does this work then? jsfiddle.net/TylerH/5ho9yskc/2

    – TylerH
    Sep 20 '18 at 16:38






  • 1





    Because the original question requires the wildcard to work on the attribute itself. For instance, a CSS rule that aims to style all attributes that begin with [custom-] - where the asterisk () represents the wildcard. This is not possible.

    – CodeUK
    Oct 6 '18 at 23:04

















Why does this work then? jsfiddle.net/TylerH/5ho9yskc/2

– TylerH
Sep 20 '18 at 16:38





Why does this work then? jsfiddle.net/TylerH/5ho9yskc/2

– TylerH
Sep 20 '18 at 16:38




1




1





Because the original question requires the wildcard to work on the attribute itself. For instance, a CSS rule that aims to style all attributes that begin with [custom-] - where the asterisk () represents the wildcard. This is not possible.

– CodeUK
Oct 6 '18 at 23:04






Because the original question requires the wildcard to work on the attribute itself. For instance, a CSS rule that aims to style all attributes that begin with [custom-] - where the asterisk () represents the wildcard. This is not possible.

– CodeUK
Oct 6 '18 at 23:04














12














As you have pointed out, there are multiple ways to target the value of an HTML attribute.





  • E[foo="bar"]



    an E element whose "foo" attribute value is exactly
    equal to "bar"





  • E[foo~="bar"]



    an E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar"





  • E[foo^="bar"]



    an E element whose "foo" attribute value begins exactly with the string "bar"





  • E[foo$="bar"]



    an E element whose "foo" attribute value ends exactly with the string "bar"





  • E[foo*="bar"]



    an E element whose "foo" attribute value contains the substring "bar"





  • E[foo|="en"]



    an E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en"





But there is only one way to target the attribute name itself:





  • E[foo]



    an E element with a "foo" attribute





Hence, there are currently no methods for wildcarding attribute names:



div[data-*] ... /* may be useful, but doesn't exist */
div[data-^] ... /* may be useful, but doesn't exist */


source: W3C Selectors Level 3 Specification




From another answer to a similar question:




There is a recent
thread
in the www-style@w3.org mailing list, where Simon Pieters from Opera
has proposed a nice possible
syntax
that has got some acceptance in the thread, so there is a chance that
it will become standard somewhen in the future:



x-admin-* ... 
[data-my-*] ...






share|improve this answer




















  • 1





    Thank you for enlisting all the possibilities on how wild-card matching works for the values of CSS attributes. It really helped understand OP's question better.

    – RBT
    Jun 20 '17 at 8:25















12














As you have pointed out, there are multiple ways to target the value of an HTML attribute.





  • E[foo="bar"]



    an E element whose "foo" attribute value is exactly
    equal to "bar"





  • E[foo~="bar"]



    an E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar"





  • E[foo^="bar"]



    an E element whose "foo" attribute value begins exactly with the string "bar"





  • E[foo$="bar"]



    an E element whose "foo" attribute value ends exactly with the string "bar"





  • E[foo*="bar"]



    an E element whose "foo" attribute value contains the substring "bar"





  • E[foo|="en"]



    an E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en"





But there is only one way to target the attribute name itself:





  • E[foo]



    an E element with a "foo" attribute





Hence, there are currently no methods for wildcarding attribute names:



div[data-*] ... /* may be useful, but doesn't exist */
div[data-^] ... /* may be useful, but doesn't exist */


source: W3C Selectors Level 3 Specification




From another answer to a similar question:




There is a recent
thread
in the www-style@w3.org mailing list, where Simon Pieters from Opera
has proposed a nice possible
syntax
that has got some acceptance in the thread, so there is a chance that
it will become standard somewhen in the future:



x-admin-* ... 
[data-my-*] ...






share|improve this answer




















  • 1





    Thank you for enlisting all the possibilities on how wild-card matching works for the values of CSS attributes. It really helped understand OP's question better.

    – RBT
    Jun 20 '17 at 8:25













12












12








12







As you have pointed out, there are multiple ways to target the value of an HTML attribute.





  • E[foo="bar"]



    an E element whose "foo" attribute value is exactly
    equal to "bar"





  • E[foo~="bar"]



    an E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar"





  • E[foo^="bar"]



    an E element whose "foo" attribute value begins exactly with the string "bar"





  • E[foo$="bar"]



    an E element whose "foo" attribute value ends exactly with the string "bar"





  • E[foo*="bar"]



    an E element whose "foo" attribute value contains the substring "bar"





  • E[foo|="en"]



    an E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en"





But there is only one way to target the attribute name itself:





  • E[foo]



    an E element with a "foo" attribute





Hence, there are currently no methods for wildcarding attribute names:



div[data-*] ... /* may be useful, but doesn't exist */
div[data-^] ... /* may be useful, but doesn't exist */


source: W3C Selectors Level 3 Specification




From another answer to a similar question:




There is a recent
thread
in the www-style@w3.org mailing list, where Simon Pieters from Opera
has proposed a nice possible
syntax
that has got some acceptance in the thread, so there is a chance that
it will become standard somewhen in the future:



x-admin-* ... 
[data-my-*] ...






share|improve this answer















As you have pointed out, there are multiple ways to target the value of an HTML attribute.





  • E[foo="bar"]



    an E element whose "foo" attribute value is exactly
    equal to "bar"





  • E[foo~="bar"]



    an E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar"





  • E[foo^="bar"]



    an E element whose "foo" attribute value begins exactly with the string "bar"





  • E[foo$="bar"]



    an E element whose "foo" attribute value ends exactly with the string "bar"





  • E[foo*="bar"]



    an E element whose "foo" attribute value contains the substring "bar"





  • E[foo|="en"]



    an E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en"





But there is only one way to target the attribute name itself:





  • E[foo]



    an E element with a "foo" attribute





Hence, there are currently no methods for wildcarding attribute names:



div[data-*] ... /* may be useful, but doesn't exist */
div[data-^] ... /* may be useful, but doesn't exist */


source: W3C Selectors Level 3 Specification




From another answer to a similar question:




There is a recent
thread
in the www-style@w3.org mailing list, where Simon Pieters from Opera
has proposed a nice possible
syntax
that has got some acceptance in the thread, so there is a chance that
it will become standard somewhen in the future:



x-admin-* ... 
[data-my-*] ...







share|improve this answer














share|improve this answer



share|improve this answer








edited May 23 '17 at 11:46









Community

11 silver badge




11 silver badge










answered Apr 27 '16 at 13:28









Michael_BMichael_B

168k51 gold badges277 silver badges386 bronze badges




168k51 gold badges277 silver badges386 bronze badges







  • 1





    Thank you for enlisting all the possibilities on how wild-card matching works for the values of CSS attributes. It really helped understand OP's question better.

    – RBT
    Jun 20 '17 at 8:25












  • 1





    Thank you for enlisting all the possibilities on how wild-card matching works for the values of CSS attributes. It really helped understand OP's question better.

    – RBT
    Jun 20 '17 at 8:25







1




1





Thank you for enlisting all the possibilities on how wild-card matching works for the values of CSS attributes. It really helped understand OP's question better.

– RBT
Jun 20 '17 at 8:25





Thank you for enlisting all the possibilities on how wild-card matching works for the values of CSS attributes. It really helped understand OP's question better.

– RBT
Jun 20 '17 at 8:25











-2














YES, you can select all elements that have any value of a specified attribute:



[type] selects all elements that have a type="anything". attribute






share|improve this answer

























  • This is actually correct; I'm not sure why it is downvoted. (see jsfiddle.net/TylerH/5ho9yskc/1)

    – TylerH
    Sep 20 '18 at 16:35







  • 1





    It's rightly downvoted because it is not answering the question about wildcard attribute name.

    – Asaf Agranat
    Dec 9 '18 at 16:00















-2














YES, you can select all elements that have any value of a specified attribute:



[type] selects all elements that have a type="anything". attribute






share|improve this answer

























  • This is actually correct; I'm not sure why it is downvoted. (see jsfiddle.net/TylerH/5ho9yskc/1)

    – TylerH
    Sep 20 '18 at 16:35







  • 1





    It's rightly downvoted because it is not answering the question about wildcard attribute name.

    – Asaf Agranat
    Dec 9 '18 at 16:00













-2












-2








-2







YES, you can select all elements that have any value of a specified attribute:



[type] selects all elements that have a type="anything". attribute






share|improve this answer















YES, you can select all elements that have any value of a specified attribute:



[type] selects all elements that have a type="anything". attribute







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 13 '17 at 19:04









Alexan

4,6129 gold badges56 silver badges78 bronze badges




4,6129 gold badges56 silver badges78 bronze badges










answered Apr 13 '17 at 18:21









Joshua CopelandJoshua Copeland

93 bronze badges




93 bronze badges












  • This is actually correct; I'm not sure why it is downvoted. (see jsfiddle.net/TylerH/5ho9yskc/1)

    – TylerH
    Sep 20 '18 at 16:35







  • 1





    It's rightly downvoted because it is not answering the question about wildcard attribute name.

    – Asaf Agranat
    Dec 9 '18 at 16:00

















  • This is actually correct; I'm not sure why it is downvoted. (see jsfiddle.net/TylerH/5ho9yskc/1)

    – TylerH
    Sep 20 '18 at 16:35







  • 1





    It's rightly downvoted because it is not answering the question about wildcard attribute name.

    – Asaf Agranat
    Dec 9 '18 at 16:00
















This is actually correct; I'm not sure why it is downvoted. (see jsfiddle.net/TylerH/5ho9yskc/1)

– TylerH
Sep 20 '18 at 16:35






This is actually correct; I'm not sure why it is downvoted. (see jsfiddle.net/TylerH/5ho9yskc/1)

– TylerH
Sep 20 '18 at 16:35





1




1





It's rightly downvoted because it is not answering the question about wildcard attribute name.

– Asaf Agranat
Dec 9 '18 at 16:00





It's rightly downvoted because it is not answering the question about wildcard attribute name.

– Asaf Agranat
Dec 9 '18 at 16:00

















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%2f21222375%2fcss-selector-for-attribute-names-based-on-a-wildcard%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