Loading ...

CSS Hover Effect

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  getting started / general asp.net   » CSS Hover Effect

CSS Hover Effect

Posts under the topic: CSS Hover Effect

Posted: 6/14/2011

Lurker 360  points  Lurker
  • Joined on: 6/5/2011
  • Posts: 51

Is it possible to exclude just a single link from a CSS hover effect?


Posted: 6/15/2011

Professional 8505  points  Professional
  • Joined on: 5/3/2010
  • Posts: 391

Mike Riemer said:

Is it possible to exclude just a single link from a CSS hover effect?

Hi Mike,

Please explain what do you mean by '...exclude just a signle link' ?

Thanks,
Hajan


Posted: 6/15/2011

Lurker 360  points  Lurker
  • Joined on: 6/5/2011
  • Posts: 51

To clarify; I meant that I had used A CSS style to create a color change on hover. But I had actually a login status control I wanted to exclude.

Actually I found an easier solution to my problem. I has used a css style  for a hover effect(just changing the color on hover).  I was using a login status control to show the word "Welcome". This way it would only be visable when the user was logged in(I set the logged out text to ""). The problem was the hover effect was changing the color of the word "Welcome". So what I ended up doing was setting the forecolor to the same as the hover color. That way it appears not to change. I cannot remember how, but I made it so it can't be clicked, so it looks static to the end user but only appears when logged in.

 

Thanks.


Posted: 6/15/2011

Professional 8505  points  Professional
  • Joined on: 5/3/2010
  • Posts: 391

Ahh... I see...

Well, when creating CSS rules for HTML elements that the style should apply or not, you should have in consideration where and how it will affect.

If you put hover on anchor tags, like a and a:hover styles, then you may want for some anchor tags to exclude the hover, you can add .nohover class and apply the same style as in the normal state.

Example

<style>
a { color:red; }
a:hover { color: blue; }
a:hover.nohover { color: red; }
</style>


<a href="#">Hajan</a><br />
<a href="#" class="nohover">Hajan - no hover</a>


So, you will just need to add class="nohover" to the elements where you don't want the hover style and you are all done.

Hope this helps,
Hajan


Posted: 6/15/2011

Lurker 360  points  Lurker
  • Joined on: 6/5/2011
  • Posts: 51

WOW that was exactly what I was looking for!  Thanks I am sure that will be very valuable to me in the future.

 

Thanks


Posted: 6/15/2011

Professional 8505  points  Professional
  • Joined on: 5/3/2010
  • Posts: 391
  Answered

 

Mike Riemer said:

 

WOW that was exactly what I was looking for!  Thanks I am sure that will be very valuable to me in the future.

Thanks

 

 

Nice :)! I'm glad my reply was helpful.

Don't forget to Mark As Answer the posts that helepd you resolve your problem or gave you idea of howto resolve it ;)!


Page 1 of 1 (6 items)