Reputation: 657
I am trying to style my category list for my layout, but for some reason, the list wordpress generates is not picking up my CSS.
Here's the relevent code:
CSS:
.post-categories ul {
margin-left: 0;
padding-left: 0;
display: inline;
}
.post-categories ul li {
margin: 0 5px 0 0;
padding: 3px 5px;
border: 2px solid rgb(253,22,66);
list-style: none;
display: inline;
color: rgb(253,22,66);
}
Wordpress PHP:
<?php echo get_the_category_list(); ?>
Which generates:
<ul class="post-categories">
<li><a href="http://noellesnotes.com/category/music/" title="View all posts in Music" rel="category tag">Music</a></li>
<li><a href="http://noellesnotes.com/category/thoughts/" title="View all posts in Thoughts" rel="category tag">Thoughts</a></li>
</ul>
Any help would be greatly appreciated!
Upvotes: 1
Views: 108
Reputation: 241198
You were selecting a ul
that is a descendant of .post-categories
. Instead of using .post-categories ul
, you would use ul.post-categories
, which selects a ul
element with class .post-categories
. This works for the given HTML structure.
Updated CSS - EXAMPLE HERE
ul.post-categories {
margin-left: 0;
padding-left: 0;
display: inline;
}
ul.post-categories li {
margin: 0 5px 0 0;
padding: 3px 5px;
border: 2px solid rgb(253,22,66);
list-style: none;
display: inline;
color: rgb(253,22,66);
}
Upvotes: 1