Kenneth O'Donnell
Kenneth O'Donnell

Reputation: 93

Wordpress Customize the widget partent css and parent of parent css

I want to change the color of the parent and the sub parent category into two different colours. Currently using the following code for my widget side tab.

.widget ul {background: gray;padding-top: 1px;}
.widget ul li {background:lightgray;margin: 1px;}
.widget ul a{background-color:darkgray;padding:1px;}

looking to change the font colour. I have tried many options but still not getting it right.enter image description here

Upvotes: 1

Views: 83

Answers (2)

Minal Chauhan
Minal Chauhan

Reputation: 6158

Try this:

.widget ul li.parent > a {
    color: red !important;
}

Upvotes: 2

robertpauldev
robertpauldev

Reputation: 79

It's hard to say without seeing your HTML structure, but are each of the sub-parent links ('Access Control', 'Electronic locks', etc) their own ul tags?

If so, could you not target each of their first li's like this:

.widget ul > li:first-of-type > a {
    color: red;
    /* INSERT STYLES */    
}

This would target all uls' first li > a elements, as in the image on the right.

Upvotes: 1

Related Questions