Jump to content

Different css for every <li> in main menu


Recommended Posts

Hello to all great community here!

 

At the header menu, the html structure is:

 

<ul>

<li>menu item 1</li>

<li>menu item 2</li>

<li>menu item 3</li>

<li>menu item 4</li>

<li>menu item 5</li>

<li>menu item 6</li>

</ul>

 

I have 6 menu items and I want the first three to float left and the other three to float right, because I want to place the logo in the middle of the menu.

 

But I can not place css code, because each <li> must have a unique css class to select it.

 

How do I add for each <li> a different css class dynamically? For example:

 

<ul>

<li class="first">menu item 1</li>

<li class="second">menu item 2</li>

<li class="third">menu item 3</li>

<li class="fourth">menu item 4</li>

<li class="fifth">menu item 5</li>

<li class="sixth">menu item 6</li>

</ul>

 

In the "blocktopmenu.tpl" I have this code that generates the menu

 

<ul class="menu">

{$MENU}

 

Is there a way to tell it that every <li> that will be generated, to have its own unique css selector?

 

Thank you in advance!

Edited by singular (see edit history)
Link to comment
Share on other sites

<div class = "main-lain">
<div id = "1st-list">
<ul>
<li>menu</li>
<li>menu</li>
<li>menu</li>
</ul>
</div>

<div id = center-logo>
<img src = "?######?">
</div>

<div id = 2nd-list>
<ul>
<li>menu</li>
<li>menu</li>
<li>menu</li>
</ul>
</div>
</div>
-----------------------CSS-----------
.main-lain
{width:900px; height:30px;}

#1st-list
{width:300px;height:30px;float:left;margin-left:0;position:absolute;display:inline;}

#2nd-list
{width:300px;height:30px;float:left;margin-left:0;position:absolute;display:inline;}

#center-logo
{width:300px;height:30px;float:left;margin-left:0;position:absolute;display:inline;}

Edited by mynamesStephanie (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...