style not working in IE

W

WJ

This sample works in Firefox, but not in IE 6.x. I can't figure out the
problem.
Any input would be appreciated. On the hover, I expect the text to turn red
and the weight to turn bold.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Test</title>


<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">

<style type="text/css">

..labelcell {
color : Black;
background-color : #e2f1b6;
font-family : Verdana, Arial, Helvetica, Sans-serif;
font-size : 10px;
font-weight : normal;
line-height : 15px;
text-align : center;
border-right: #afc863 1px solid;
padding-right: 2px;
border-top: #74a403 1px solid;
padding-top: 2px;
border-left: #afc863 1px solid;
padding-left: 2px;
border-bottom: #74a403 1px solid;
padding-bottom: 2px;
}

..linkcell a:visited {
FONT-WEIGHT: normal; COLOR: #000000; TEXT-DECORATION: none
}

..linkcell a:hover {
FONT-WEIGHT: bold; COLOR: #FF0000; TEXT-DECORATION: underline
}
</style>


</head>
<body>


<table border="0" cellspacing="2" cellpadding="0" width="780"
align="center">
<tr>
<td class="labelcell">
<span class="linkcell"><a
onclick="javascript:getDetail(1)">View</a></span>



</td>
<td colspan="4" class="list_link_filler">&nbsp;</td>
</tr>
</table>

</body>
</html>
 
N

Neredbojias

With neither quill nor qualm, WJ quothed:
This sample works in Firefox, but not in IE 6.x. I can't figure out the
problem.
Any input would be appreciated. On the hover, I expect the text to turn red
and the weight to turn bold.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Test</title>


<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">

<style type="text/css">

.labelcell {
color : Black;
background-color : #e2f1b6;
font-family : Verdana, Arial, Helvetica, Sans-serif;
font-size : 10px;
font-weight : normal;
line-height : 15px;
text-align : center;
border-right: #afc863 1px solid;
padding-right: 2px;
border-top: #74a403 1px solid;
padding-top: 2px;
border-left: #afc863 1px solid;
padding-left: 2px;
border-bottom: #74a403 1px solid;
padding-bottom: 2px;
}

.linkcell a:visited {
FONT-WEIGHT: normal; COLOR: #000000; TEXT-DECORATION: none
}

.linkcell a:hover {
FONT-WEIGHT: bold; COLOR: #FF0000; TEXT-DECORATION: underline
}
</style>


</head>
<body>


<table border="0" cellspacing="2" cellpadding="0" width="780"
align="center">
<tr>
<td class="labelcell">
<span class="linkcell"><a
onclick="javascript:getDetail(1)">View</a></span>



</td>
<td colspan="4" class="list_link_filler">&nbsp;</td>
</tr>
</table>

</body>
</html>

IE does hover only on links so put a class on them.
 
A

Andy Dingley

This sample works in Firefox, but not in IE 6.x.

Try this

<span class="linkcell"><a href="#"
onclick="getDetail(1); return false;" >View</a></span>


IE only supports :hover on links, and "link" means an <a> with a href
attribute, not just a <a>.

The href added here is a dummy and because the onclick event returns
false it won't be activated, even if clicked.

You don't need the "javascript:" pseudo-protocol, because this is an
even handler attribute, not a url.

I advise against using bold in a hover CSS rule, because it makes the
link text wider and causes the text to re-flow. It's often a jerky page,
 
W

WJ

Awesome, thanks!

I was using the bold to just see if obviously change.
The style I want is text-decoration:underline and
curser:pointer on the hover.

I was trying to avoid the href="#" because this is
in a search result page, which can sometimes be
longer than the browser window.

When I click on that after scrolling, the page "jumps"
to the top just before executing the javascript.

It works fine, just a little annoying to look at. Do you
know a way to implement this and prevent that "page jump"?
 
A

Andy Dingley

It works fine, just a little annoying to look at. Do you
know a way to implement this and prevent that "page jump"?

I told you already - return false from the onclick handler. That stops
further processing of the click event, including using the href for
navigation.
 
W

WJ

I told you already - return false from the onclick handler. That stops
further processing of the click event, including using the href for
navigation.

Got it! Sorry, that took two readings. :) Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top