By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,787 Members | 1,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,787 IT Pros & Developers. It's quick & easy.

Attribute selector help.

P: n/a
Alright, it has been a *long* time since I read a CSS spec, so here is my question(s).

1. I have seen styles like this:

element#idName[id]

What does the "[id]" part do? I mean, it is already inside an element with an ID of
"idName" so why is the attribute included? Is it doing something that I am just not aware
of?

2. How could I apply a style to all Ps with an ID of fn? n being a number from 1 to
whatever.

I thought that:

p[id~="f"]

....would do it, but apparently not.

Thanks.

-Lost
Jan 18 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
-Lost wrote:
Alright, it has been a *long* time since I read a CSS spec, so here
is my question(s).
Then you should probably read it again. All your answers are there.

http://www.w3.org/TR/REC-CSS2/selector.html
2. How could I apply a style to all Ps with an ID of fn? n being
a number from 1 to whatever.

I thought that:

p[id~="f"]

...would do it, but apparently not.
You just have to list them all out separately.

#f1,#f2,#f3,...
{
color: red;
}

Maybe you should be using classes?
Jan 18 '07 #2

P: n/a
"Chris Vogel" <ch***@chrisvogel.namewrote in message
news:Sa****************@bignews6.bellsouth.net...
-Lost wrote:
>Alright, it has been a *long* time since I read a CSS spec, so here
is my question(s).

Then you should probably read it again. All your answers are there.

http://www.w3.org/TR/REC-CSS2/selector.html
I imagine I worded that incorrectly. My point was that I did not understand it (or I
thought I might not understand it fully).

I have it sorted now.
>2. How could I apply a style to all Ps with an ID of fn? n being
a number from 1 to whatever.

I thought that:

p[id~="f"]

...would do it, but apparently not.

You just have to list them all out separately.

#f1,#f2,#f3,...
{
color: red;
}

Maybe you should be using classes?
Yeah, that is what I was currently using. Was not sure if there was another method to
just point at IDs (since they were mandatory, classes were not).

Thanks all the same.

-Lost
Jan 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.