Forums

Id or class name for a static page (4 posts)

  1. gorkreg
    Member
    Posted 1 month ago #

    Is it possible to give different styles from my style.css to an specific static page? If I am in the page "Clients" I want the content of that post/page to be styled different to the other pages.

    I tried with the id name of the post, for example:

    #167 h2 {...}

    But it doesn't work.

    Any ideas?

  2. cais
    Member
    Posted 1 month ago #

    If you are using the body_class() function and '#167' is referring to the page ID, try something like this:

    .page-item-167 h2 {...}
  3. gorkreg
    Member
    Posted 1 month ago #

    Thanks cais! It's .page-id-167 instead of .page-item-167 but it works.

  4. cais
    Member
    Posted 1 month ago #

    Yes, you are correct, gorkreg!

    'post-item-167' would be from the post_class() function, my bad ... glad you sorted it out.

Reply

You must log in to post.

About this Topic