ID Selector (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


enrightd -> ID Selector (10/22/2003 16:43:38)

quote:


The id Selector
The id selector is different from the class selector! While a class selector may apply to SEVERAL elements on a page, an id selector always applies to only ONE element.


Why, When, and Where would I want to use and ID Selector.




c1sissy -> RE: ID Selector (10/22/2003 17:00:06)

quote:

ORIGINAL: enrightd

quote:


The id Selector
The id selector is different from the class selector! While a class selector may apply to SEVERAL elements on a page, an id selector always applies to only ONE element.


Why, When, and Where would I want to use and ID Selector.


Since I am just learning all of this, does it make a difference? ID seems so confusing, still, to me, though I think I might be getting a grasp on it.

Are there instances where the id is really necessary? OR can you just use a class?




gorilla -> RE: ID Selector (10/22/2003 18:13:41)

ID selectors are a very similar to class selectors, they work in a very similar way, their syntax is also very similar.

The most important difference is that while class selectors apply to one or more elements on a page, ID selectors apply to exactly one element and one element only.

Consider that you wish to have several different link styles one horizontal and one vertical. For navigation bars you might wish to have radically different styling for horizontal and vertical nav bar links. You could set up classes. But it makes more sense to set up ids and only use class for common elements.

They are also often used for setting up boxes in layouts.

There is quite a good lesson on it here:

http://codepunk.hardwar.org.uk/acss06.htm

I suggest that you read all the way through to lesson 8 on this. The examples are very clear. and may give you an idea or two :-)

Jesper Berendtsen
Gorilla Group

(edited to correct my spelling!)




c1sissy -> RE: ID Selector (10/22/2003 20:43:08)

Jesper:
Thanks for your information.

I'm going there now!

btw, welcome.[;)]

<edit>WOW, great site! Thanks sooo much for the link!!!</edit>




enrightd -> RE: ID Selector (10/23/2003 15:00:27)

Jesper:

Thanks, That lesson was very helpful and makes sense.




c1sissy -> RE: ID Selector (10/23/2003 23:42:22)

I just have to let you know how THRILLED!! I am with this link!

I hve printed the whole section on advanced CSS and am reading thorugh it now. After I read it I'll play with the styles as I read it again.

This is totally exciting! I'm actually grasping the IDs!!!




gorilla -> RE: ID Selector (10/24/2003 1:36:16)

It is a good site and a good course. We often send people that link. I am pleased that you find it useful.

JB.

Note to anyone considering CSS but a little nervous about learning a new way of doing things- the intrdouctory course on that site is excellent also.




c1sissy -> RE: ID Selector (10/24/2003 7:41:51)

quote:

ORIGINAL: gorilla

It is a good site and a good course. We often send people that link. I am pleased that you find it useful.

JB.

Note to anyone considering CSS but a little nervous about learning a new way of doing things- the intrdouctory course on that site is excellent also.


I was up until about 1am reading the material that I printed out on this site. There are several things in the intro course that I plan on printing out as well.

I would higly recomend this site to everyone.[;)]




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625