Given the poor current browser css support for this, perhaps the best thing would be to write a small bit of DOM script that would add a class to that first li for you, on the fly, on page load. It would go something like this:

function styleFirstLI(){ // by divaHTML.com
        var d=document;
        if (!d.getElementsByTagName()) return;
        var zULs=d.getElementsByTagName('ul');
        for (var i=0, len=zULs.length;i<len;i++){
                var li=zULs[i].firstChild;
                li.className='firstLI';
        }
}

Watch for my typos.

Add a class 'firstLI' to your stylesheet.

Then call styleFirstLI() on page load, and of course after the uls have been generated by your other scripts.

Hope that helps.

--

E. Michael Brandt

www.divaHTML.com
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz

www.valleywebdesigns.com
JustSo PictureWindow
JustSo PhotoAlbum

--

Nick Roper wrote:
I need to target the 1st item in a list. However, to make things complicated I can't assign a class or id to it. This is because of the way that the code is generated.

So, given the following example code:

<h3 class="someClass">Heading Text</h3>
<ul class="someOtherClass"> <li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>

Is there a way that I can target the <li> for Item 1 without it having a specific id or class assigned to it?

Thanks in anticipation.




*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to