Public Voice Network
- DaftPunk 226226
- Thanks Obama.. 88
- QBN EXPATS 4242
- Auto Racing? 1616
- Black People :/ 170170
- QBN Personas 1717
- blog 5771757717
- the gif animation thread 1850118501
- Show some recent work 55645564
- Paid vacation? 3232
- FMT 250513 33
- Pic of the Day 7480474804
- Blue people ;~ 3737
- Official Infographics Thr… 172172
- Best American band of all… 134134
- instagram 656656
- London machete attack 6969
- Champions League 2012-13 9797
- Nice dj/club websites? 55
- Official NSFW Thread 264264
- Architecture of the Day 437437
- Chick of the Day 1825718257
- The Purge 2121
- Trailer Of The Day 800800
css attribute selectors 1717 Responses
Last post: 3 years, 9 months ago | Thread started: Aug 26, 09, 1:13 p.m.
- jbenjohnson
Does anybody know of a list of all the possible attribute selectors that can be used? I know the basics like href, title, class, etc. But I want to know all my options.
cheers
- Aug 26, 09, 1:13 p.m. – Permalink
- jbenjohnson
what about targeting a URL?


- Dog-earAug 26, 09, 2:28 p.m. – Permalink
- jbenjohnson
for example, i want to auto-select a navigation item. can I do that via an attribute selector? (I can't touch the html).


- Dog-earAug 26, 09, 2:30 p.m. – Permalink
- jbenjohnson
yes. i'll check the link - i think it gave me an idea. thx


- Dog-earAug 26, 09, 2:57 p.m. – Permalink
- neverblink
this is actually pretty easy to do with jQuery, although when changing the css with JQ, it will take effect after the page has loaded.
$("a [href='mylink.html']").css()
or addClass() or whatever you want to do with it

- Dog-earAug 27, 09, 12:48 a.m. – Permalink
- Stugoo
you can use any attribute to select any element in any (modern) browser (other than ie6). or you can use javascript (as mentioned above).
the you can find the attributes supported for each element here :
http://www.google.com/url?sa=t&a…
(pdf)
- Dog-earAug 27, 09, 1:57 a.m. – Permalink
- jbenjohnson
good list stugoo. thx.
I'd love to use javascript, but I can't add anything to the HTML, I can only modify the CSS.
So i was thinking, if there was a way with an attribute selector i could say - when you're on a page that has "red" in the URL, the Red navigation item would be auto-selected.
Make sense?
again, I could easily accomplish this via html and js, but i don't have that option

- Dog-earAug 27, 09, 6:54 a.m. – Permalink
- jbenjohnson
i don't really have anything at this point. the nav is in a UL and I'm trying to figure out the CSS.
<ul>
<li><a href="#">Red</a></li>
<li><a href="#">Black</a></li>
</ul>

- Dog-earAug 27, 09, 7:14 a.m. – Permalink
- TheBlueOne
add an ID to the body tag and style from there, no?

- Dog-earAug 27, 09, 8:52 a.m. – Permalink
- jbenjohnson
acescence - that's what i started with, but its not dynamic, it always makes that link red... am i reading that right?


- Dog-earAug 27, 09, 12:45 p.m. – Permalink
- monNom
CSS3
http://www.w3.org/TR/css3-select…a[href*="red"]
poorly supported to date.


- Dog-earAug 27, 09, 1:30 p.m. – Permalink


