Closed Bug 265163 Opened 20 years ago Closed 20 years ago

<a /> with <img /> having display:block behaves strange

Categories

(Core :: Layout: Block and Inline, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 152806

People

(Reporter: paul.piskorz, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1

In the page at http://testy.pless.pl/PablO/img_display.html you can notice, that
<a /> (with blue border) seems to have nothing inside, and the <img /> (red
border, display:block ) behaves like it would be inside <a /> with display:block
- you can click on the space to it's right side, not only direct on it.

Reproducible: Always
Steps to Reproduce:
1. Create a page with image in a link
2. Set image style to "display:block"

Actual Results:  
I've noticed that space on the right side of image is clickable and the link
itself appears to have nothing inside.

Expected Results:  
The space on the right side of image shouldn't be clickable, because image has
it's dimensions. The image should be inside the link.
Except for the extra little bit of blue above the image (piece of an inline that
perhaps shouldn't be there), this seems correct.
Whiteboard: DUPEME
(Though it's worth double-checking CSS 2.1.)
Assignee: dbaron → nobody
Component: Style System (CSS) → Layout: Block and Inline
QA Contact: ian → core.layout.block-and-inline
This little bit of blue is <a /> inside of what the <img /> is.
I know.  (There aren't any other inlines.)
For me it looks like image have position:absolute or float (it is taken out of
normal flow), and padding-right:100%-imageWidth.

According to the specs, image width should be as it specified in <img /> tag:

http://www.w3.org/TR/CSS21/visudet.html#q7
The used value of 'width' is determined as for inline replaced elements.

http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width
If 'width' has a computed value of 'auto' and 'height' also has a computed value
of 'auto', the element's intrinsic width is the used value of 'width'.

Didn't read about any extra padding.

*** This bug has been marked as a duplicate of 152806 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.