ThemeShaper Forums » Thematic

[closed]

Using 2 body classes

(5 posts)
  • Started 4 years ago by helgatheviking
  • Latest reply from helgatheviking
  • This topic is resolved
  1. Can I use multiple body classes in my css? This doesn't seem to work for me. I'd like to have css that targets the home page only if it is a static page... and so not if it is the default blog index. Basically on a static home page I will remove the widget asides and go full width, but leave the asides in place for a blog. I thought that:

    .home .page #content {
    }

    would let me control the #content on a static home page, but no luck. Same w/ .page .home.

    any insight on to how to tackle this? Should I just apply a template to be able to use that body class? Seems unnecessary otherwise.

    Posted 4 years ago #
  2. Most browsers accept double classes (ie6, always the exception: http://stackoverflow.com/questions/312022/use-double-classes-in-ie6-css).

    You'd do it like (no space in between):

    .home.page #content {}

    I pasted the body classes for each to do a test:

    wordpress blogid-1 y2010 m05 d12 h22 home blog not-singular loggedin mac firefox ff3

    wordpress blogid-1 y2010 m05 d12 h22 home singular slug-about page pageid-2 page-author-devin page-parent page-comments-open page-pings-open loggedin mac firefox ff3

    It looks as though the "blog" class is unique to the blog layout vs. a selected front page.

    Posted 4 years ago #
  3. awesome, thanks devin. i thought it had to be something relatively simple.

    and can IE6 just die already?

    Posted 4 years ago #
  4. For the benefit of anyone wanting to punish themselves with support for IE6. IE6 will only respect declarations for the last class in a gouping of multiple classes for a single element.

    So for div class="hentry content wide-col logged-in" ie6 will only apply styles declared for the final class in the stack in this case .logged-in

    It is for this reason that Thematic's dynamic body class function applies browser version specific classes and ie6 last in the stack for the body classes.

    If you're using Thematic and need to debug CSS for IE6 you can use the .ie6 body class to give you a "more specific ancestor" as mentioned in the stackoverflow discussion that Devin linked above.

    Posted 4 years ago #
  5. "For the benefit of anyone wanting to punish themselves" classic! i like the idea of a huge popup that says "hey upgrade to a browser from this decade!".. or something similar.

    do you have any idea what the market share of IE6 is? For my own sites I can't be bothered by IE6, but is it still worth it for professional sites?

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.