WordPress.org

Ready to get started?Download WordPress

Forums

Display categories differently on front page (4 posts)

  1. orbited
    Member
    Posted 3 years ago #

    Dear All,

    This is probably a real simple thing for you CSS wizkids out there. The thing is that I would like to display a certin category differently on my first page. I've created a Links-category, and would like them not to be as prominent as my more thorough posts.

    So, I figured I'd wrap my posts in a div class that reflect the name of the category and then apply different styling using CSS.

    In a very simplified example my first page would look something like this:

    <div class="cat-misc">
        <div class="post">
            <p>Test</p>
            <div class="headline">Headline</div>
        </div>
    </div>
    
    <div class="cat-link">
        <div class="post">
            <p>Test</p>
            <div class="headline">Headline</div>
        </div>
    </div>

    Using CCS I know i can affect for example the <p>-tag and make it display differently using:

    .cat-link p {
    }

    Now for the question
    But as you can see in my example above each post also gets styled by other div classes. Is there any way I can get a div class to display differently if enclosed by another div, like I can with tags like <p>?

    Best,

    / Jonathan

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    .cat-misc .post {some style};
    .cat-link .post {different style}
  3. orbited
    Member
    Posted 3 years ago #

    Funny, it didn't work the first time around. But now, sir, I'm on my way! Thanks! :)

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    No problem :-)

Topic Closed

This topic has been closed to new replies.

About this Topic