Public Voice Network
- RIP James Gandolfini 77
- Four tet is Burial 1313
- a screen printed, black-l… 22
- Drumming World Record 33
- Pic of the Day 7541775417
- RIP Tony Soprano 33
- PS4 vs X-Box One 4747
- The Million Dollar YouTub… 2020
- Chick of the Day 1831118311
- Waterproof Camera for a k… 66
- US State Outlines? 1010
- the gif animation thread 1880418804
- I am Bradley Manning 55
- Music Videos 624624
- Video Games... 995995
- Jr-Mid Level Designer - S… 44
- Mid-Sr Level Designer NYC 88
- EC: David Rudnick 11
- ganja thread 2.0 527527
- Vid of the Day 1529615296
- Halp! I need a photograph… 4444
- Music Video of the Day 33
- studio desks 66
- Show some recent work 56065606
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


