Chang Huang wrote:
> Thanks you both. I've forgotten to mention that the list is  
> dynamically generated, sorry, so it's not possible to predict the last  
> 'special' item.
>
> I also tried "li[class='special']:last-child" with no success.
>
> I guess I'll have to use jQuery to do it.
>
>
> On 6 September, at 6 September 2:46 PM, David Laakso wrote:
>
>   
>> Chang Huang wrote:
>>     
>>> Hi, I'm trying to get the last element that belongs to a specific   
>>> class. For example,
>>>
>>> <ul>
>>>     <li>aaa</li>
>>>     <li class="special">bbb</li>
>>>     <li>ccc</li>
>>>     <li>ddd</li>
>>>     <li>eee</li>
>>>     <li class="special">fff</li>
>>>     <li class="special">ggg</li>
>>>     <li>hhh</li>
>>> </ul>
>>>
>>> I need to get the last 'li' with the class 'special' ('<li   
>>> class="special">ggg</li>'), is it possible to do that without JS?
>>>
>>> I tried '.special:last-child { color:red; }', but it doesn't seem  
>>> to  work.
>>>
>>> Thanks!
>>>
>>>       
>>
>>
>>
>> Use a multible class thing?
>> <http://chelseacreekstudio.com/ca/cssd/special.html>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>     
>
> ______________________________________________________________________
> css-discuss [[email protected]]
> http://www.css-discuss.org/mailman/listinfo/css-d
> List wiki/FAQ -- http://css-discuss.incutio.com/
> List policies -- http://css-discuss.org/policies.html
> Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
>
>   
This would be better suited for a web design list as programming is off 
topic but if you could show me the script for generating the list I 
would be willing to see if I could help you dynamically generate a class 
for the last special.
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to