Reputation: 489
In wordpress template I have navigation meniu
<nav id="main-menu">
<?php
$home_url = home_url();
$menu = wp_nav_menu(array('theme_location' => 'main', 'menu_id' => 'menu', 'echo' => false,
'menu' => 'LT'));
$menu = str_replace('#HOME_URL', $home_url, $menu);
echo $menu;
?>
</nav>
I want that last of menu link will be red I try this
ul#main-menu li a:last-child{color: red;}
but it not work.
Upvotes: 0
Views: 106
Reputation: 23580
Assuming your structure is like that:
<ul id="main-menu">
<li><a></a></li>
<li><a></a></li>
</ul>
You have to use:
#main-menu li:last-child > a { color: red; }
As you're referring to the last <li>
-element.
Upvotes: 1