Links style with CSS

  • Hi,

    I’m trying to apply these rules for links:

    Customizer / General / Underline links: on hover. This applies to all links.

    But on a normal paragraph for pages and posts, I would like to have this:

    – They should always be underlined.
    – Base color: #2C7A7B
    – Hover color: #0D9488
    – The underline should remain on hover.
    – Make sure this applies only to inline links inside <p>, and does not affect buttons, headings, menus, or other link elements.

    I tried this CSS, but didn’t work

    p a {
    color: #2C7A7B;
    text-decoration: underline;
    }

    p a:hover {
    color: #0D9488 !important;
    text-decoration: underline;
    }

    Can you please tell me how to achieve what I need? Thank you so much.

  • Hi there,

    Your CSS should work.

    Can you provide your site link and point me to an example?

    Let me know 🙂

  • Hi,

    Thank you for your reply!

    I was double checking and the problem is that I was looking at links on lists.

    So I’ve just added that to the code and now it is fine.

    p a,
    li a {
    color: #2C7A7B;
    text-decoration: underline;
    }

    p a:hover,
    li a:hover {
    color: #0D9488;
    text-decoration: underline;
    }

    Sorry for taking you time!

  • Nice! Glad you got it working 🙂

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