Welcome to the Geeks & God Static Archive. Read more »

possible in css?

Joined: 11/28/2008

I could be missing something really obvious here, but... is it possible to attach a seperate style sheet for an individual div rather than using a class for every single element within that div?

...so e.g. for div#content I want the links to behave differently to those in div#menu, but would prefer to just set that for the whole div if that's possible, rather than having to create an a.menulink class and then set every link in div#menu to class="menulink".

Wishful thinking...?


Joined: 11/28/2008
If all you want to do is have

If all you want to do is have the behaviour of the links to change in a particular <div> then you don't need a seperate stylesheet. You can specify elements that are 'descendant' from other elements, ie

div#content a

which would refer to an <a href> element inheriting from the <div id="content"> element which is different from

div#menu a

where an <a href> element inherits from the <div id="menu">. This way the #content section can be different from the #menu section.


Cheamweb Your window into the Fraser Valley
Dave's Journey | The Macfoto Life

Joined: 11/28/2008
D'oh. I knew it would be

D'oh. I knew it would be obvious.

Thanks David! /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />