INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Hyperlinks: CSS Pseudo Selectors and Hyperlinked Images and Other Non-Textual Content

Hyperlinks: CSS Pseudo Selectors and Hyperlinked Images and Other Non-Textual Content

Hyperlinks: CSS Pseudo Selectors and Hyperlinked Images and Other Non-Textual Content

(OP)
Help!

I'm trying to define textual hyperlinks for a footer. I also have images in my footer that are also hyperlinked.

The CSS I'm using is:

CODE

#footer a:link    { text-decoration: underline; color: #F8F8F7; font-weight: 600; padding: 2px; }
#footer a:visited { text-decoration: underline; color: #F8F8F7; font-weight: 600; padding: 2px; }
#footer a:hover   { text-decoration: none;      color: #fff;    font-weight: 600; padding: 2px; background-color: #blue; }
#footer a:active  { text-decoration: underline; color: #F8F8F7; font-weight: 600; padding: 2px; } 


The problem is that in my HTML, within my footer, I also have images that are hyperlinked. For example,

CODE

<a href="http://mywebsite.com"><img src="http://mywebsite.com/image/picture.png" style="margin: 20px 0;"></a> 


Now, because my image above has a top & bottom margin of 20px, my hyperlinked image shows an unsightly blue background when I hover my mouse over it. How can I stop this from happening? I don't want any linking effect on my images - just only my textual content. Help!

Thanks in advance,
JD.

RE: Hyperlinks: CSS Pseudo Selectors and Hyperlinked Images and Other Non-Textual Content

Hi JD

Try adding border="0" in the image tag, thus <img src="http://mywebsite.com/image/picture.png" style="margin: 20px 0;" border="0">

Regards
Graham

RE: Hyperlinks: CSS Pseudo Selectors and Hyperlinked Images and Other Non-Textual Content

Quote:


Try adding border="0" in the image tag, thus <img src="http://mywebsite.com/image/picture.png" style="margin: 20px 0;" border="0">

how is a border going to stop the background?


Anyway,

Your CSS applies to any links inside your footer element.

If you don't want it applying to other links, then specify which links you do want it applied to by giving them a class:

CODE

<a href="..." class="linkstogetcss">

 ----

#footer a.linkstogetcss:link    { ... }
#footer a.linkstogetcss:visited { ... }
#footer a.linkstogetcss:hover   { ... }
#footer a.linkstogetcss:active  { ... } 

That way your css will only apply to links with that particular class.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: Hyperlinks: CSS Pseudo Selectors and Hyperlinked Images and Other Non-Textual Content

(OP)
That works! Thank you so much for helping a poor sap out. Btw, I discovered that the missing attribute, in my initial comment, was background: none;. Regardless, Phil's solution is more graceful.

Thanks again!

Best,
Dipesh.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close