By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,624 Members | 2,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,624 IT Pros & Developers. It's quick & easy.

Hover emulating in IE

P: n/a
Hello.

How can simple emulating in IE this class ?

..example:hover{
border: 1px solid #696969;
}

Greets,
Cezar.
Jul 20 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Cezar wrote:
How can simple emulating in IE this class ?
Sorry, I cannot quite grasp what you're asking. Can you try rephrasing
it in clearer words?
.example:hover{
border: 1px solid #696969;
}


This looks correct; what is the problem you are having? Are you trying
to create hover styles on something other than an <a> element?

By the way, it's best not to *add* a border on :hover. Consider
changing only the border color on :hover.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #2

P: n/a
On Tue, 15 Jun 2004 02:28:43 +0200, Cezar <ce*****@imail.net.pl> wrote:
Hello.

How can simple emulating in IE this class ?

.example:hover{
border: 1px solid #696969;
}

Greets,
Cezar.


If I'm right, you want to get :hover to work in IE on elements other than
<a>. You'll need to use something like Javascript to do this.
Jul 20 '05 #3

P: n/a
Neal <ne*****@yahoo.com> wrote:
If I'm right, you want to get :hover to work in IE on elements other
than <a>. You'll need to use something like Javascript to do this.


Yes, manipulating the element's style in Javascript, e.g.

<style type="text/css">
..example { border: solid 1px white; }
</style>
<script type="text/javascript">
function setborder(elem,color) {
elem.style.borderColor = color; }
</script>
....
<p class="example"
onmouseover="setborder(this,'#696969')"
onmouseout ="setborder(this,'white')">
This is an example.</p>

(Naturally you get better advice on Javascript in
news:comp.lang.javascript and its FAQ.)

It would be possible, though hardly wise, to play some ugly tricks to
make e.g. a paragraph's entire text an <a> element (naturally assuming it
does not contain any real <a> elements) and to do your best to make it
_not_ behave as a link except for the purpose of :hover styling. E.g.,

<style type="text/css">
..example a { display: block;
background: white;
color: black;
text-decoration: none;
cursor: default;
border: solid 1px white; }
..example a:hover { border-color: #696969; }
</style>
<script type="text/javascript">
function setborder(elem,color) {
elem.style.borderColor = color; }
</script>
....

<p class="example"><a name="a42" href="#a42" tabindex="0">
This is an example.</a></p>

However it would still behave as a link in many ways, disturbing the
user. You could remove part of the problem by using an onfocus="..." and
onclick="..." attribute that try to prevent the element from getting
focus and to disable any clicking effects, but then you're on your way to
using more Javascript than you need for the relatively simple idea of
simulating :hover with Javascript.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #4

P: n/a
> Sorry, I cannot quite grasp what you're asking. Can you try rephrasing
it in clearer words?
.example:hover{
border: 1px solid #696969;
}


This looks correct; what is the problem you are having? Are you trying
to create hover styles on something other than an <a> element?

By the way, it's best not to *add* a border on :hover. Consider
changing only the border color on :hover.


This code not working in IE. That's why I ask for possible solution :-)

..buttons2{
background: #fafafa url(../pic/inputbg2.gif);
padding:0;
margin:0 0 0 6px;
cursor:pointer;
height:25px;
border: 1px solid #a9a9a9;
}
..buttons2:hover{
border: 1px solid #696969;
}

Greets,
Cezar.
Jul 20 '05 #5

P: n/a
> If I'm right, you want to get :hover to work in IE on elements other than
<a>. You'll need to use something like Javascript to do this.


Yes, You right. So, I have to ask on javascript group.

Cezar
Jul 20 '05 #6

P: n/a
"Cezar" <ce*****@imail.net.pl> wrote:
Hello.

How can simple emulating in IE this class ?

.example:hover{
border: 1px solid #696969;
}


http://www.vladdy.net/demos/iepseudoclassesfix.html

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #7

P: n/a
Cezar wrote:
This code not working in IE. That's why I ask for possible solution :-)


I cannot help you without a url. The code snippets you wrote do not
provide the necessary information.
--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #8

P: n/a
"Cezar" <ce*****@imail.net.pl> wrote:
Hello.

How can simple emulating in IE this class ?

.example:hover{
border: 1px solid #696969;
}


People have suggested javascript, and Messinger suggested the
'behaviors' one can use with IE.

If you also need a visited state, however, and I don't know if you do,
then you'd have to stick with an anchor, and essentially use styles to
expand an anchor over the area that you wish to behave as an anchor.
If that's not what you need to do, then jscript or behaviors would
seem the thing.
Jul 20 '05 #9

P: n/a
Thanks for any advices.

I used script from this example
http://www.xs4all.nl/~peterned/examples/cssmenu.html.
Working good.

Regards,
Cezar.

Uzytkownik "Harlan Messinger" <hm*******************@comcast.net> napisal w
wiadomosci news:ht********************************@4ax.com...
"Cezar" <ce*****@imail.net.pl> wrote:
Hello.

How can simple emulating in IE this class ?

.example:hover{
border: 1px solid #696969;
}


http://www.vladdy.net/demos/iepseudoclassesfix.html

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.

Jul 20 '05 #10

P: n/a
Cezar wrote:
Hello.

How can simple emulating in IE this class ?

.example:hover{
border: 1px solid #696969;
}

Greets,
Cezar.

You can use the IE7 IE compatibility patches by Dean Edwards.
See http://dean.edwards.name/IE7 for more info.
Jul 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.