Closed Bug 74712 Opened 25 years ago Closed 25 years ago

CSS a:hover borders appear wrong

Categories

(Core :: Layout, defect)

x86
Windows 98
defect
Not set
trivial

Tracking

()

VERIFIED INVALID

People

(Reporter: handgestrickt, Assigned: clayton)

References

Details

From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98) BuildID: 2001032319 I made use of a little CSS a:hover effect. Everytime you point on an image in an anchor, the image gets little borders. This worked great on MSIE and O.K. on Opera. But Gecko seemed to render the border sometimes not, sometimes at a wrong position (a little bit under the image)..... Reproducible: Sometimes Steps to Reproduce: 1.put an image into an a tag. set image-border to zero 2.create an a:hover{border:1px solid #0000ff} 3. Actual Results: the problem appeared only sometimes (t seems to appear only on bigger images) Expected Results: This problem is not sooooo very important. Would be nice if it works someday in the future
I suspect this is invalid. The image is displayed as an inline object, and thus is placed on a text line; the result is the height of the border will be the value of |line-height|. To get the effect you are looking for (a solid line around the image?), you need to set the image to be |display: block;|. Ian, or someone, wanna verify this? It is a little difficult to do since it's not the most unambiguous report.
Actually, the height of the border is just the height of the <a> element. Which is the height of the current font (font-size), not the line-height... If the image is taller than the current font, it simply overflows the <a> element. The bug is nevertheless invalid, since the style is on the <a> and the height of the <a> has nothing to do with the height of the image... What you should be doing is one of: 1) Set the border on the _image_, not the anchor. That is: a:hover > img { border: 1px solid red } or a:hover img { border: 1px solid red } depending on how your document is structured. 2) Make the anchor be display:table-cell. setting the image to display:block does not work (and I don't think it should). Setting status to invalid, and QA to Hixie for verification
Status: UNCONFIRMED → RESOLVED
Closed: 25 years ago
QA Contact: bsharma → ian
Resolution: --- → INVALID
bz knows all :-)
Status: RESOLVED → VERIFIED
SPAM. HTML Element component deprecated, changing component to Layout. See bug 88132 for details.
Component: HTML Element → Layout
But why so all other browsers do this "right" (wrong if I read you correctly), and only mozilla this way?
*** Bug 104742 has been marked as a duplicate of this bug. ***
*** Bug 119634 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.