Forum Moderators: not2easy

Message Too Old, No Replies

List item border and background disappear on mouseover!

         

yisraelharris

8:38 am on Jan 23, 2007 (gmt 0)

10+ Year Member



In the code below, if you mouseover the word 'here', the border and image disappear. What is causing this to happen? (I'm running MSIE 6 on Windows XP.)

(For the image, get '077988alpha_cat.gif', in the folder 'img', at the website <url removed>. It's a 10px by 9px bullet.)

NOTE: solutions which do not explain the problem do not help me -- I can fix the problem myself in any number of ways. What I need to know is WHY the problem is happening in the first place. Thank you.

Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<style>
.container { float: right; width: 162px; padding-top:270px; }
.module { position: relative; overflow: hidden; width: 100%; }
.module-content { margin: 0 0 0 10px; }
.module-list { margin: 0; }
.module-list-item { background: url(alpha_cat.gif) 130px 4px no-repeat; padding:0 25px 0 0; border:1px solid black;}
h2 { font-size: 10pt; background-color: #F6F6F6; }
a {text-decoration:none; border-bottom:1px dashed #cccccc; }
a:hover{border-bottom:0px solid #cccccc; }
</style>
<div class="container" dir="rtl" style="text-align:right;">
<div class="module">
<h2>X</h2>
<div class="module-content">
<ul class="module-list">
<li class="module-list-item"><a href="#">here</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>

[edited by: encyclo at 3:46 pm (utc) on Jan. 23, 2007]
[edit reason] no links to personal sites please, see forum charter [/edit]

mep00

1:31 pm on Jan 23, 2007 (gmt 0)

10+ Year Member



One of the first steps in solving a css problem is to start with valid code. The required structure of a document (with the optional addition of a style block is as follows:

<!DOCTYPE...
<html>
[b]<head>
<title></title>
<style>
</style>
</head>[/b]
<body>
</body>
</html>

Why try to understand how IE handles invalid code when it's often hard enough trying to understand how it handles valid code?

cmarshall

2:06 pm on Jan 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mep00 is correct. You should define your styles in the head section.

However, I'm having a difficult time figuring out exactly what it is you are trying to do. There's a great deal of positioning in there, and, I suspect, some unnecessary CSS.

CSS is best served with as little embellishment as possible. I'll lay odds that the problem is caused by all the background positioning you are using. I'd suggest removing attributes and trying to do more with less as a start.

bobming

3:30 pm on Jan 23, 2007 (gmt 0)

10+ Year Member



Had a play around with your code, unsurprisingly it stops happening when you take out the line:-

a:hover{border-bottom:0px solid #cccccc; }

What are you trying to achieve with that line anyway? It makes no sense!

To fix this bug, I would seriously suggest planning properly what you're trying to do and start again. As has been mentioned, there's far too much unnecessary code in there.