Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS rollover IE problem 1

Status
Not open for further replies.

rrsub

MIS
Oct 23, 2002
536
US
I've seen the other posts about this but I feel I'm missing something here.

This code does what I want which is to change the background on a hover on browsers that are not IE.

What is the IE fix/workaround for this?

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" >
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<title>Test</title>
	<style type="text/css" title="Default" media="screen">
#cont{
	width: 500px;
}
#button{
	border-bottom: 1px solid #0F0;
	background: #ccccff;
	display: block;
}
#button:hover{
	background: #ffcccc;
}

	</style>
</head>
<body>
<div id="cont">
	<div id="button">
		<a href="#">Link</a>
	</div>
</div>
</body></html>
 
Javascript onmouseover and onmouseout event handlers. For your example, I would simply go with styling the <a> element, where IE has no trouble recognizing :hover pseudo class.
 
Vragabond,

You rock and I'd buy you lunch if you were local.
I'm still working on my problem here:

I'm table less and still working on the template but it's coming out how I want.

I'll post my style in comparison to the table layout I left on that post when I'm done.
 
In ie use
Code:
<style>
a:hover#button{
    background-color: #ffcccc;
}
</style>
<a href="#" id="button">asdasd</a>

or

Code:
<style>
a:hover.button{
    background-color: #ffcccc;
}
</style>
<a href="#" class="button">asdasd</a>
this will work in firefox as well
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top