singular Posted May 18, 2012 Share Posted May 18, 2012 (edited) 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 May 18, 2012 by singular (see edit history) Link to comment Share on other sites More sharing options...
coeos.pro Posted May 18, 2012 Share Posted May 18, 2012 Hi, have you try first-child in CSS : http://www.w3schools.com/cssref/sel_firstchild.asp exemple : ul:first-child li {your code css} else you must add "class" in the $MENU but it's not in smarty, in php Link to comment Share on other sites More sharing options...
singular Posted May 18, 2012 Author Share Posted May 18, 2012 Thank you for the quick reply! I've tried this and also the li+li+li+li... in css with no success. Can you tell me plese how to do this with php? Link to comment Share on other sites More sharing options...
coeos.pro Posted May 18, 2012 Share Posted May 18, 2012 (edited) where do you found this module ? Edited May 18, 2012 by coeos.pro (see edit history) Link to comment Share on other sites More sharing options...
singular Posted May 18, 2012 Author Share Posted May 18, 2012 it came with this tempate that I have purchased: http://addons.prestashop.com/en/food-drinks/4593-Prestashop-Cake-Shop---EGRTME5.html Link to comment Share on other sites More sharing options...
coeos.pro Posted May 18, 2012 Share Posted May 18, 2012 I thought it was a free module, the correct modules are always in smarty and not fully in php, ask to the webmaster if he can help you and if it can optimize a minimum this module Link to comment Share on other sites More sharing options...
singular Posted May 18, 2012 Author Share Posted May 18, 2012 Already contacted him! Thank you coeos.pro for the replies! Link to comment Share on other sites More sharing options...
mynamesStephanie Posted May 18, 2012 Share Posted May 18, 2012 why you do not create another one but same class. Link to comment Share on other sites More sharing options...
singular Posted May 18, 2012 Author Share Posted May 18, 2012 Can you please be more specific? Link to comment Share on other sites More sharing options...
mynamesStephanie Posted May 19, 2012 Share Posted May 19, 2012 (edited) <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 May 19, 2012 by mynamesStephanie (see edit history) Link to comment Share on other sites More sharing options...
mynamesStephanie Posted May 19, 2012 Share Posted May 19, 2012 just only a sample what i understand, or else attached the image sample of menu, what u mean Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now