WordPress.org

Ready to get started?Download WordPress

Forums

A STYLE application question (2 posts)

  1. danielt
    Member
    Posted 6 years ago #

    Hi everyone,

    I have a conundrum. I'm somewhat, but not nearly enough, versed in code to solve this problem.

    I have a theme that has a certain color contrast which makes a nice effect when you highlight a link, it makes the background of that text a solid color and changes the text color. However, the style is applied from the css page, to all links. It uses code a: which I infer means any anchor.

    I have a few links that are anchored to images. One of these images contains transparency. What happens is under the image a bit of the background color gets applied, and it looks goofy. Ordinarily if it was just a regular image, I'd just make the background of it solid based on where it's located on the page. However, it's an animated gif, and it would be more work to decode it and apply the background.

    So, my question is how can I setup that style so it will only apply it if the anchor is text and not image?

    Here's what it has in the css file:

    a:hover { color: #000; background-color: #0f0; }

    I was researching this and came upon some mention that you can override a style by applying a new style right in the page where the specific item exists. I tried playing with this but I don't quite know what the code should be.

    Any help is appreciated.
    Thanks

  2. Adam Brown
    Member
    Posted 6 years ago #

    Access the image's style properties like this:

    a:hover img{background-color:transparent;}

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.