Click to See Complete Forum and Search --> : nested classes?


cusimar9
11-22-2006, 11:12 AM
I've just tried to do this and IE has thrown a wobbly:


#mainform .loadingimage {....}


Can I not have a class within an ID style?

ryanbutler
11-22-2006, 11:43 AM
You can do that, but to get the most helpful results, we'll need to see a page.

cusimar9
11-22-2006, 11:55 AM
Thanks I spotted a spelling mistake that's what was buggering it up

felgall
11-22-2006, 01:14 PM
Since an id must be unique the class reference is redundant since either the element with the id also has the class in which case specifying both is equivalent to just specifying the id or the element doesn't have the class in which case the code will never apply.

cusimar9
11-22-2006, 04:52 PM
felgall, this is how I use it in this particular example:

<form id=bigform>
... loads of code ...
... loads of images ...
<img class=loadingimage ... >
</form>

<form id=smallform>
... loads of code ...
... loads of images ...
<img class=loadingimage ... >
</form>


And I have 2 definitions for loadingimage, one for the small form, and one for the big form.

Then I don't have to change the code, I just have to change the form id and everything else changes. To me this makes more sense than having to have 2 different loadingimage classes (loadingimagesmall and loadingimagebig), particularly when they'll never be used APART FROM inside the form.