Reputation: 3063
I'm using a WordPress theme with a vertical navigation menu. I'd like to add a colored dot to the left of the active menu item like on the image below. How could I do that? Below is the CSS code controlling the active menu item.
.vertical_menu_toggle .second .inner ul li.current_page_item a {
}
Upvotes: 2
Views: 3630
Reputation: 32275
Try using the CSS code below. Description in comments.
/* Set the disc and its color */
.vertical_menu_toggle .second .inner ul li.current_page_item {
color: #D0021B;
list-style-type: disc;
}
/* Remove the default underline */
.vertical_menu_toggle .second .inner ul li a {
color: #CCC;
text-decoration: none;
font-weight: bold;
}
/* Remove the disc on other list elements */
.vertical_menu_toggle .second .inner ul li {
list-style-type: none;
}
<h3>Art Works</h3>
<div class="vertical_menu_toggle">
<div class="second">
<div class="inner">
<ul>
<li><a href="">2010 to date</a>
</li>
<li class="current_page_item"><a href="">2000 to 2009</a>
</li>
<li><a href=" ">1990 to 1999</a>
</li>
</ul>
</div>
</div>
</div>
Upvotes: 5
Reputation: 3599
Taking into consideration the extra classes in your case: .vertical_menu_toggle .second .inner
which play no important role here.
list-style: none
.visibility: hidden
..vertical_menu_toggle .second .inner ul {
list-style: none; /* hide default bullets for all list items*/
padding: 0;
margin: 0;
}
/*put red dot before all the active list items*/
.vertical_menu_toggle .second .inner ul li.current_page_item:before {
content: "• "; /*don't miss the space*/
color: red;
}
/*put dot but make it invisible before the inactive list items*/
.vertical_menu_toggle .second .inner ul li:not(.current_page_item):before {
content: "• "; /*don't miss the space*/
visibility: hidden;
}
/***extra***/
/*not absolutely important*/
h3 {
font-family: Impact, sans-serif;
font-size: 36px;
}
li {
font-family: monospace;
font-weight: bold;
font-size: 24px;
}
.vertical_menu_toggle .second .inner ul li {
padding-left: 1em;
text-indent: -.7em;
}
<h3>Art Works</h3>
<div class="vertical_menu_toggle">
<div class="second">
<div class="inner">
<ul>
<li>2010 to date</li>
<li class="current_page_item">2000 to 2009</li>
<li>1990 to 1999</li>
</ul>
</div>
</div>
</div>
Upvotes: 4