469,572 Members | 1,336 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

Hover effect for non-anchor tags

CJM
Is it possible to achieve a hover effect for a non-anchor tag in CSS?

I can use the following code, but it goes against the grain:
<a href="" onclick="return false;">Label</a>

Surely there must be a 'proper' way of doing it?

Thanks

Chris
Jul 20 '05 #1
12 6352
CJM wrote:
Is it possible to achieve a hover effect for a non-anchor tag in CSS?

I can use the following code, but it goes against the grain:
<a href="" onclick="return false;">Label</a>

Surely there must be a 'proper' way of doing it?


Just find a client that correctly implements the :hover pseudo-class for all
elements (hint: not IE).

--
Steve

It is curious that physical courage should be so common in the world and moral
courage so rare. -Mark Twain
Jul 20 '05 #2
In post <bm************@ID-209813.news.uni-berlin.de>
CJM said...
Is it possible to achieve a hover effect for a non-anchor tag in CSS?


the :hover pseudo-class can apply to any element. opera and mozilla
have support for hover on elements other than <a>. you need to test.

--
brucie.
13/October/2003 09:16:15 pm
Jul 20 '05 #3
CJM
Hmmm.... I had a horrible feeling this would be the answer....

This is an intranet system. Guess what our standard browser is....

Oh well....

CJM

"Steve Fulton" <ce********@hotmail.com> wrote in message
news:rE*******************@news20.bellglobal.com.. .
CJM wrote:
Is it possible to achieve a hover effect for a non-anchor tag in CSS?

I can use the following code, but it goes against the grain:
<a href="" onclick="return false;">Label</a>

Surely there must be a 'proper' way of doing it?
Just find a client that correctly implements the :hover pseudo-class for

all elements (hint: not IE).

--
Steve

It is curious that physical courage should be so common in the world and moral courage so rare. -Mark Twain

Jul 20 '05 #4
CJM wrote:
Hmmm.... I had a horrible feeling this would be the answer....

This is an intranet system. Guess what our standard browser is....

Then you'd have more luck in a microsoft.* group.

You might be able to implement hover-like functionality in IE with a behavior.
<http://msdn.microsoft.com/workshop/author/behaviors/howto/using.asp>

--
Steve

The wise man learns more from his enemies than a fool does from his friends.
-Chinese proverb
Jul 20 '05 #5
CJM
No... I'm not prepared to do an IE-only page. My javascript solution depends
on J(ava)Script not being disabled in the browser, but at least it offers
some form of browser independance.

We are not about to declare Mozilla our standard browser, but at least we
wont be precluding it...

Cheers

Chris

"Steve Fulton" <ce********@hotmail.com> wrote in message
news:P0*******************@news20.bellglobal.com.. .
CJM wrote:
Hmmm.... I had a horrible feeling this would be the answer....

This is an intranet system. Guess what our standard browser is....

Then you'd have more luck in a microsoft.* group.

You might be able to implement hover-like functionality in IE with a

behavior. <http://msdn.microsoft.com/workshop/author/behaviors/howto/using.asp>

--
Steve

The wise man learns more from his enemies than a fool does from his friends. -Chinese proverb

Jul 20 '05 #6
"CJM" <cj*****@yahoo.co.uk> wrote:
My javascript solution depends
on J(ava)Script not being disabled in the browser, but at least it
offers some form of browser independance.


We don't even know the real problem, so we cannot estimate the adequacy
of the solution. What is the problem that you expect to solve with the
hover effect (which?) for a non-anchor element? Is there any reason why
the user would move the mouse over a normal innocent element?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #7
Jukka K. Korpela wrote:
[snip]
We don't even know the real problem, so we cannot estimate the
adequacy of the solution. What is the problem that you expect to
solve with the hover effect (which?) for a non-anchor element? Is
there any reason why the user would move the mouse over a normal
innocent element?


Perhaps, perhaps not. But ....

"Title" often causes a UA to display tooltips when hovering over "a normal
innocent element". IE 6, Firebird 0.6.1, Opera 7.2, and Netscape 7.1 all do
this when hovered over some of the cells of:
http://www.birdsandanimals.info/

I won't comment on whether this is good or bad. I'll simply suggest that some
consistency would be useful, and if tooltips can be shown, why not be able to
change other properties too?

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #8
Jukka K. Korpela wrote:
...
Is there any reason why the user would move the mouse over a
normal innocent element?


torment - the pursuit of joy at the expense of anothers pain.

--
William Tasso - http://WilliamTasso.com
Jul 20 '05 #9
Jukka K. Korpela wrote:

Is there any reason why
the user would move the mouse over a normal innocent element?


It may likely happen by accident, while moving the mouse to some
unrelated item on the screen, maybe even in the window of another app
altogether.

--
To email a reply, remove (dash)un(dash). Mail sent to the un
address is considered spam and automatically deleted.

Jul 20 '05 #10
CJM
The hover effect will be used in a javascript menu on our intranet. It is
to give the users the impression that menu categories *are* links and thus
can be clicked!

The menu is in a frameset, with other IE-only tweaks.

There are other horrors too...

You (the 'purists') could point out all sorts of problems with our setup
here, however I think it would be unfair to kick a man when he is down.

Outside work, I'm creating an accessible & standards-compliant website for a
charity. In work, I'm am being coerced in to creating a frankenstein's
monster of an intranet.

I know I'm not a purist, and I bend a few rules from time to time, but I'm
better than this.

Chris

"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message
news:Xn*****************************@193.229.0.31. ..
"CJM" <cj*****@yahoo.co.uk> wrote:
My javascript solution depends
on J(ava)Script not being disabled in the browser, but at least it
offers some form of browser independance.


We don't even know the real problem, so we cannot estimate the adequacy
of the solution. What is the problem that you expect to solve with the
hover effect (which?) for a non-anchor element? Is there any reason why
the user would move the mouse over a normal innocent element?

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Jul 20 '05 #11
"CJM" <cj*****@yahoo.co.uk> wrote:
The hover effect will be used in a javascript menu on our intranet.


Thank you. Now please keep using the usual clueless indicators, until
you have something on-topic to say. Thank you in advance.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #12
CJM
> Thank you. Now please keep using the usual clueless indicators, until
you have something on-topic to say. Thank you in advance.


WTF??

What kind of trip are you on?

My original post was very succinct. It was a technical question that
required a technical answer, which Steve kindly provided. The :hover
pseudo-class is not fully implemented in IE. That's all I needed to know.

*Your* response was off-topic:
"We don't even know the real problem, so we cannot estimate the adequacy
of the solution. What is the problem that you expect to solve with the
hover effect (which?) for a non-anchor element? Is there any reason why
the user would move the mouse over a normal innocent element?"

My post did not ask you to 'estimate the adequacy of the solution' [sic].

'We don't even know the real problem' - I didn't tell you. You don't need to
know.

Answer the question, ask for clarification if you dont understand, or choose
not to answer it. We are grateful for any help you choose to give, but we
don't *expect* that you must give it.

My previous post was supposed to appease you and others like you. We all
like to do a good job, but sometimes we have to do things we dont agree
with. This is a fact of life. If my boss wants, usually my boss gets....

Clearly you are a very capable technician, but I question your skills as a
diplomat. I'm sure there will be opportunities in the future where I could
benefit from your help, but I'd rather rely on the other posters if it
avoids any more of your presumptuous and distasteful posts.

I know that this post wont make any difference, but I have a duty of care to
try.

Apologies for a truly off-topic post.

Chris
Jul 20 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Nikolaos Giannopoulos | last post: by
12 posts views Thread by Alan J. Flavell | last post: by
8 posts views Thread by PhilM | last post: by
12 posts views Thread by Sander Tekelenburg | last post: by
2 posts views Thread by Philip Herlihy | last post: by
51 posts views Thread by madsgormlarsen | last post: by
reply views Thread by phil-news-nospam | last post: by
24 posts views Thread by fehays | last post: by
1 post views Thread by darkzone | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.