[WSG] div#links, or #links?

2006-05-23 Thread Designer

In a different context, Mathew Patterson wrote:

I would suggest you look at Eric Myer's website, here:
http://www.meyerweb.com/eric/css/edge/popups/demo2.html

I've noticed before that Mr Meyer quite often uses stuff like:

[1]  div#links a:hover img {position: absolute;  etc.

whereas I would just say :

[2]   #links a:hover img {position: absolute; etc.

Given that Eric Mayer is one smart guy, and I am not ( :-) ), I find myself being intrigued as to why he does this.  Is there a reason?  
Does the preceding 'div' actually do anything, or is it simply saying that it's the id of a div, as opposed to an id of something other than a div???


Anyone?

--
Best Regards,

Bob McClelland

Cornwall (UK)
www.gwelanmor-internet.co.uk


**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**



Re: [WSG] div#links, or #links?

2006-05-23 Thread Lachlan Hunt

Designer wrote:

I've noticed before that Mr Meyer quite often uses stuff like:

[1]  div#links a:hover img {position: absolute;  etc.

whereas I would just say :

[2]   #links a:hover img {position: absolute; etc.




I find myself being intrigued as to why he does this.  Is there a reason?


There are several possible reasons:

1. Increase the specificity.
2. Differentiate between the id used on a div element and on, for 
example, a ul element. (The same ID may be used on a different element 
on a different page using the same stylesheet)

e.g. page 1 uses: div id=links
 page 2 uses: ul id=links

(Just assume there would be a semantic reason for using a different 
element on different pages)


3. It may just be an authoring convention.

--
Lachlan Hunt
http://lachy.id.au/
**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list  getting help
**