473,467 Members | 1,477 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Changing Paragraph Color on Hover in IE

I have some paragraphs on a page that I'd like have change color when
the mouse is hovering over them.

This declaration works great in Firefox and Safari, but doesn't do
anything in IE.

p:hover.review
{
color: #FFCC00;
padding: 0px;
margin: 10px;
}
....
<p class="review">my paragraph and stuph</p>
I've searched for an IE technique to change the text color without luck
- does anyone know how I could implement it?

Thanks,
philz
Jul 21 '05 #1
7 8022
squidco <za*****@squidcoRemoveMe.com> wrote in news:040420051931058327%
za*****@squidcoRemoveMe.com:
p:hover.review


Unfortunately, IE does not support hover on any elements other than the
good ole' anchor tags.

There is a special htc hover file which bridges this gap. There is a
lot of information online about it.

<http://www.xs4all.nl/~peterned/csshover.html>

--
Arctic Fidelity <sp**@sacrificumdeo.net>
<http://www.sacrificumdeo.net>
"Beware of bugs in the above code; I have only proved it correct, not
tried it." -- Donald Knuth

Jul 21 '05 #2
squidco wrote:
I have some paragraphs on a page that I'd like have change color when
the mouse is hovering over them.

This declaration works great in Firefox and Safari, but doesn't do
anything in IE.

p:hover.review
{
color: #FFCC00;
padding: 0px;
margin: 10px;
}
...
<p class="review">my paragraph and stuph</p>
I've searched for an IE technique to change the text color without luck
- does anyone know how I could implement it?

Thanks,
philz


in IE :hover only works on a anchor+href

Jul 21 '05 #3
Arctic Fidelity <sp**@sacrificumdeo.net> wrote in
news:Xn********************************@216.196.97 .131:
squidco <za*****@squidcoRemoveMe.com> wrote in news:040420051931058327%
za*****@squidcoRemoveMe.com:
p:hover.review


Unfortunately, IE does not support hover on any elements other than the
good ole' anchor tags.

There is a special htc hover file which bridges this gap. There is a
lot of information online about it.

<http://www.xs4all.nl/~peterned/csshover.html>


I thought I should give a bit more detail about how to implement this
in a nice and efficient manner, the information is found elsewhere, but
it's always nice to have it laid out. :-)

Basically, you get the csshover.htc behavior file for IE, and then put
a special "IE only" declaration in your web pages, so that all other
web browsers will ignore the behavior spec.

<!--[if IE]>
<style type="text/css" media="screen">
body { behavior: url(csshover.htc); }
</style>
<![endif]-->

Then you can apply a hover effect to any element in your page.

--
Arctic Fidelity <sp**@sacrificumdeo.net>
<http://www.sacrificumdeo.net>
"Beware of bugs in the above code; I have only proved it correct, not
tried it." -- Donald Knuth

Jul 21 '05 #4
Thanks Arctic, I went through the doc and tried to recreate the hover
behavior described, but it didn't want to work for me. Perhaps the
issue is that I'm developing on a Mac and IE behaves even differently
in our development environment... regardless, we've decided to hold off
on implementing this until we can see what the new IE CSS
implementation is like.

philz
In article <Xn********************************@216.196.97.131 >, Arctic
Fidelity <sp**@sacrificumdeo.net> wrote:
Arctic Fidelity <sp**@sacrificumdeo.net> wrote in
news:Xn********************************@216.196.97 .131:
squidco <za*****@squidcoRemoveMe.com> wrote in news:040420051931058327%
za*****@squidcoRemoveMe.com:
p:hover.review


Unfortunately, IE does not support hover on any elements other than the
good ole' anchor tags.

There is a special htc hover file which bridges this gap. There is a
lot of information online about it.

<http://www.xs4all.nl/~peterned/csshover.html>


I thought I should give a bit more detail about how to implement this
in a nice and efficient manner, the information is found elsewhere, but
it's always nice to have it laid out. :-)

Basically, you get the csshover.htc behavior file for IE, and then put
a special "IE only" declaration in your web pages, so that all other
web browsers will ignore the behavior spec.

<!--[if IE]>
<style type="text/css" media="screen">
body { behavior: url(csshover.htc); }
</style>
<![endif]-->

Then you can apply a hover effect to any element in your page.

Jul 21 '05 #5
squidco <za*****@squidcoRemoveMe.com> wrote in
news:070420051000452972%za*****@squidcoRemoveMe.co m:
Thanks Arctic, I went through the doc and tried to recreate the hover
behavior described, but it didn't want to work for me. Perhaps the
issue is that I'm developing on a Mac and IE behaves even differently
in our development environment... regardless, we've decided to hold
off on implementing this until we can see what the new IE CSS
implementation is like.


Yes, that's an unfortunate problem, as I don't think IE Mac supports
htc behavior files. Fortunately, I don't find a lot of people are using
IE Mac as much these days. I think it's becoming more phased out by
Safari. I could, of course, be misled.

--
Arctic Fidelity <sp**@sacrificumdeo.net>
<http://www.sacrificumdeo.net>
"Beware of bugs in the above code; I have only proved it correct, not
tried it." -- Donald Knuth

Jul 21 '05 #6
Arctic Fidelity wrote:
squidco <za*****@squidcoRemoveMe.com> wrote
Thanks Arctic, I went through the doc and tried to recreate the hover
behavior described, but it didn't want to work for me. Perhaps the
issue is that I'm developing on a Mac and IE behaves even differently
in our development environment... regardless, we've decided to hold
off on implementing this until we can see what the new IE CSS
implementation is like.


Yes, that's an unfortunate problem, as I don't think IE Mac supports
htc behavior files. Fortunately, I don't find a lot of people are using
IE Mac as much these days. I think it's becoming more phased out by
Safari. I could, of course, be misled.


Is Javascript an option? This works in my IE 6, Netscape 7.2, Firefox 1.0.1:

function setcolor(obj,color){
obj.style.color=color;
}

<p onmousemove="setcolor(this,'#FFAABB');"
onmouseout="setcolor(this,'#000000');">my paragraph and stuph</p>

Jul 21 '05 #7
In article <04************************@squidcoRemoveMe.com> , za*****@squidcoRemoveMe.com says...
I have some paragraphs on a page that I'd like have change color when
the mouse is hovering over them.

This declaration works great in Firefox and Safari, but doesn't do
anything in IE.

p:hover.review
{
color: #FFCC00;
padding: 0px;
margin: 10px;
}
...
<p class="review">my paragraph and stuph</p>
I've searched for an IE technique to change the text color without luck
- does anyone know how I could implement it?


Enclose it in an empty anchor tag and set text-decoration to none;

a.review
{
color: #0000;
padding: 0px;
margin: 10px;
text-decoration: none;
}

a.review:hover
{
color: #FF0000;
padding: 0px;
margin: 10px;
text-decoration: none;
}
<a href="#" class="review"><p>my paragraph and stuph</p></a>
Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Don G | last post by:
Within the menu for my site, I have inserted 'class="current"' within the link for the current page. So the link looks somthing link: <li><a href="index.php" class="current">Home</a></li> The...
4
by: Hello | last post by:
Hello, I am trying to have an image in a link to show border and change color from black to reddish when user hovers over with a cursor. In IE6 it works as I would like it to, but in Firefox1...
2
by: Marita | last post by:
I know that you can change the cell background color on mouseover, but is there a way with stylesheets that a background image can be swapped? Thanks in advance for any advice! Marita
6
by: Henry | last post by:
How can I change the text in a link, originally displayed with the "text-decoration:none" attribute to display an underline during the onMouseOver event, and back to its original (non-underlined)...
3
by: Michael Eisenstadt | last post by:
What are the coding options for client-side image size changing? I want the viewer to be able to switch between two different sizes of the same image with his/her mouse. Thanks in advance for...
25
by: madsgormlarsen | last post by:
Hi I am making a tab menu with css, and the tabs changes color depending on wich tab is current. 1. I could load a different css file for each tab/color. 2. I could do some inline css only...
12
by: Nico Schuyt | last post by:
Maybe a stupid question (I'm not so familiar with javascript), but: I want to change background of a paragraph or list item on mouseover. The following code works: <p...
15
by: phillip.s.powell | last post by:
<style> div div table tr td a.navbar, div div table tr td font {display: none;} </style> <div class="navigationbar" style="background-color:Black; position: absolute; left:50%; top:127px;...
3
by: jonniethecodeprince | last post by:
Hello everyone. I want to change the style of a HTML element. I can change the paragraph alignment to left right, justify etc. But I can seem to find the code for any other style change, for...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.