WordPress.org

Forums

[resolved] CSS limits on one page (4 posts)

  1. CanDMan
    Member
    Posted 1 year ago #

    ok... So I've searched through the forums and I can't seem to find the answer for this particular question. It may be very basic but what I am trying to do is make adjustments to the CSS that only affect individual pages. I went through the trouble of learning how to use the "inspect this element" in order to find the code for he items I want to adjust. I even read somewhere that all I have to do is put a # in front of the item to have the limit be applied to that item only. I just can't seem to figure out how to assign the limit to just one page.

    so for example, I want this:
    ul.async-list li.fb-share, ul.async-list li.gplus-share, ul.async-list li.linkedin-share, ul.async-list li.twitter-share, ul.async-list li.hn-share {display: none;}

    to be applied to my contact page only. Is there some way to do this?

  2. catacaustic
    very awesome
    Posted 1 year ago #

    Yes ,there is. You need to look at the page ID class that's set on each page, and that will let you target elements on that page only.

    As am example, one of my sites has a pge that has this:

    <body class="page page-id-87 page-parent ...">

    So, to target the elemetns that you're looking for on this page, I'd use:

    .page-id-87 ul.async-list li.fb-share,
    .page-id-87 ul.async-list li.gplus-share,
    .page-id-87 .page-id-87 ul.async-list li.linkedin-share,
    .page-id-87 ul.async-list li.twitter-share,
    .page-id-87 ul.async-list li.hn-share {display: none;}
  3. CanDMan
    Member
    Posted 1 year ago #

    Perfect! You nailed it. Nailed it to the wall.

    I had to write it all out like this:

    .page-id-16 ul.async-list li.fb-share {display: none;}
    .page-id-16 ul.async-list li.gplus-share {display: none;}
    .page-id-16 ul.async-list li.linkedin-share {display: none;}
    .page-id-16 ul.async-list li.twitter-share {display: none;}
    .page-id-16 ul.async-list li.hn-share {display: none;}

    but it worked like a charm.
    Thank you!

  4. CanDMan
    Member
    Posted 1 year ago #

    Resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags