Hi Adam:

Adam Kuehn wrote:

> Rahul Gonsalves wrote:
>
>> [1] http://www.littleandreid.com/mentaidyn/about
>>
>> <ul class="mainnav">
>> <li><a href="/" id="menu_default"><span>Home</span></a></li>
>> <li><a href="about" class="active"
>> id="menu_about"><span>About</span></a></li>
>> [--more links--]
>> </ul>
>>
>> Now, I want to assign the class "Active" to have the different
>> background. What should I do? This changes from page to page,
>> dynamically, so I can't use the ID property.
>
>
>
> Actually, you can.  IDs can be used once PER PAGE.  So long as you use 
> the ID only once on each page (which should be the case in this 
> situation, unless I am badly misunderstanding you), 

Yup. :-)

But that's because I was unclear about _what_ I want to do. I want the 
active link to be highlighted with a different colour from the other links.

The "active" class is generated dynamically by the CMS. Therefore, by 
just adding the .active class in my global CSS, each page now has the 
active link highlighted.

I can't see how I would use the ID class, unless I wrote a little CSS 
header for each page, with the background for the currently active ID 
specified. Not my idea of fun, even on the admittedly small site, as above.

> you'll be fine.  I personally prefer to use the ID in this situation 
> rather than !important as was suggested earlier, but that's really a 
> matter of choice.  

I'd rather not use !important either; Eric Meyer wrote somewhere that 
it's a mark of laziness on the part of the developer, IIRC.

> Mostly, I just wanted to make it clear that IDs do work for dynamic 
> assignments, so long as you use them carefully.  

Yup. That first statement of mine was so badly constructed, by the time 
it got from brain to screen :-P.

> It is a fairly common misconception that they don't, and it is worth 
> noting the correction for users searching the archives.
>
> HTH,
>
>
> -Adam Kuehn
>
Regards,
Rahul.

-- 

. . . . . . . . . . . . . . . . . . . . . . . .
Rahul Gonsalves
Make PNG, not War.
. . . . . . . . . . . . . . . . . . . . . . . .

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to