[Resolved] Is there a way to apply a css rule to single posts only (and not to pages)?

Home Forums Support [Resolved] Is there a way to apply a css rule to single posts only (and not to pages)?

Home Forums Support Is there a way to apply a css rule to single posts only (and not to pages)?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1002531
    Sara

    Does it makes sense to put the css in a <style> tag in a wp_head hook and apply it to all posts? Is that the proper way of doing it? Thanks in advance.

    #1002653
    Leo
    Staff
    Customer Support

    Hi there,

    You can target CSS to single posts only by adding body.single in front of your normal selector.

    For example, .main-navigation would target the navigation globally. body.single .main-navigation would target the navigation in single posts only.

    Let me know if this helps ๐Ÿ™‚

    #1002654
    Sara

    Oh, very cool. Helps a lot! Thanks.

    #1002677
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.