WordPress.org

Forums

[resolved] HOW TO USE DIFFERENT CSS FOR SAME ELEMENT (4 posts)

  1. bipin000
    Member
    Posted 3 years ago #

    I had made 10 categories in my wordpress theme of which 3 categories and its subcategories i am using as menus and rest of categories i wish to use as sidebar for my theme. the problem which i am facing is the class of the menu:

    i am using wp_list_categories()->include my 61,62,63 categories in that
    and i checked its class assign by wordpress and modified that class in my css.

    but that same class getting implemented on my sidebar to i want to prevent it and use my new class using same wp_list_categories how can i help me

  2. Andrei Olsen
    Member
    Posted 3 years ago #

    Post a link to your site or at least name a theme you're using.

  3. bipin000
    Member
    Posted 3 years ago #

    twenty

  4. bipin000
    Member
    Posted 3 years ago #

    yes now i got the solution i appended a div with a new unique id and get css to its child element and my problem is solved

    <div id="maincontent">
    
    <ul>
    <li>a</li>
    <li>b</li>
    </ul>
    <ul><li class="childres">1<li class="childres">2</ul>
    <li>c</li>
    </div>
    
    CSS used
    ====================
    
    #maincontent > li:nth-child(1)
    {
    mycustom css
    }
    
    #maincontent > li:nth-child(2)
    {
    mycustom css
    }
    
    #maincontent > li:nth-child(3)
    {
    mycustom css
    }
    
    #maincontent > li:nth-child(1)
    {
    mycustom css
    }
    #maincontent .childres>li
    {
    mycustom css
    }

    get help from :- http://css-tricks.com/5514-child-and-sibling-selectors/

Topic Closed

This topic has been closed to new replies.

About this Topic