Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Body Class in Wordpress?

    Hi

    Is anybody here familiar with body class in wordpress?

    I have different category options on the home page of I site that I am setting up, please view: www.sugartreelondon.com

    I would like to make the colour background on each of the 'more stories' bit, different for each category but cannot seem to find a way to target that element.

    The line of code used for the background is;
    Code:
    .more_stories{background:#8f8e3e;margin:0 10px 0 10px;padding:0 0 0 0;border-bottom:1px solid #d7d7d7;font-size:0.9em;font-weight:bold;}
    I thought that to target and change this I would need the code;
    Code:
    body.more_stories cat-item cat-item-3 {background:#fff;}
    But this is not working. Can anybody help?

    Thanks in advance.

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello FuxiAdmin,
    I'm not sure why the body tag is involved here.

    A better approach might be specifically targeting each ul like this -
    Code:
    #col1 .more_stories {background: #f00;}
    #col2 .more_stories {background: #00f;}
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    FuxiAdmin (11-13-2011)

  • #3
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The body class is used in wordpress to change the style of particular elements throughout a site. I am getting the more_stories from the style css and am getting that categories name cat-widget 3 etc, from the source.

  • #4
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Exactly ignore my last post, Excavator you were absolutely right, thank you so much.

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by FuxiAdmin View Post
    Exactly ignore my last post, Excavator you were absolutely right, thank you so much.
    Cascading, targeting and precedence.

    And precedence is always a good study.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •