• I would like to set up a CSS class to change the theme’s default color for specific links. I need to do this when the links appear within a colored block that’s the same color as the default link color.

    I’m hoping to do this by defining a CSS class. I’ve tried setting it up like this:

    .a:link.white-link {
    	color:	#ffffff !important;
    	}

    But if I insert white-link into Gutenberg’s Additional CSS Class(es) box for the relevant block, nothing happens. I’d really appreciate some help with this.

    Thanks.

    • This topic was modified 4 years, 9 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    Please identify exactly which theme you are using and then post in that theme’s dedicated forum so the theme’s developers and support community can help you with this.

    Moderator bcworkz

    (@bcworkz)

    You have your CSS selectors backwards for a link within a block that has a custom CSS class. Try:

    .white-link a {
      color: #fff;
    }

    What you have (without the initial dot before a) would be for an anchor tag with its own class attribute. You don’t really need the :link pseudo class unless it’s to differentiate from :visited, :hover, :active styles. Avoid using !important modifier unless it’s truly necessary. It shouldn’t be if you add your CSS to the Additional CSS panel of the customizer.

    If you still have trouble, there’s likely something unusual about your theme. Like t-p said, you should then seek help through your theme’s support. To address specific CSS needs, it’s usually important they have a live link to the page in question.

    Thread Starter tatami3lri

    (@tatami3lri)

    Thank you both for your suggestions.

    I thought this would be a generic rather than a theme-specific issue. It appears not to be. I’ve tried implementing your suggestion, @bcworkz, but unfortunately it’s not working.

    I’ve now post to the StudioPress forum (I’m using a Genesis child theme) and hoping to get some help there.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Setting color for specific links’ is closed to new replies.