-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-moz-force-broken-image-icon: alt text on height OR width set #37261
base: main
Are you sure you want to change the base?
Conversation
before: if height and width is set after: if height or width is set
This comment was marked as off-topic.
This comment was marked as off-topic.
Preview URLs Flaws (48)URL:
(comment last updated: 2024-12-30 12:55:06) |
preview looks good in my opinion |
Is it not like the following for If an image has no height or width set, the alt text may not be visible. |
For
I think the images in your example don't show the alt text because the element is too small: https://codepen.io/bsmth/pen/qEWPqEE |
sources
<h1>no force</h1>
<img class="no-force " src="x.png" alt="ALT" />
<img class="no-force " src="x.png" alt="ALT" width="50px" />
<img class="no-force " src="x.png" alt="ALT" height="50px" />
<img class="no-force " src="x.png" alt="ALT" width="50px" height="50px" />
<br>
<img class="no-force " src="x.png" />
<img class="no-force " src="x.png" width="50px" />
<img class="no-force " src="x.png" height="50px" />
<img class="no-force " src="x.png" width="50px" height="50px" />
<br>
<img class="no-force min-size" src="x.png" alt="ALT" />
<img class="no-force min-size" src="x.png" alt="ALT" width="50px" />
<img class="no-force min-size" src="x.png" alt="ALT" height="50px" />
<img class="no-force min-size" src="x.png" alt="ALT" width="50px" height="50px" />
<br>
<img class="no-force min-size" src="x.png" />
<img class="no-force min-size" src="x.png" width="50px" />
<img class="no-force min-size" src="x.png" height="50px" />
<img class="no-force min-size" src="x.png" width="50px" height="50px" />
<h1>with force</h1>
<img class="do-force " src="x.png" alt="ALT" />
<img class="do-force " src="x.png" alt="ALT" width="50px" />
<img class="do-force " src="x.png" alt="ALT" height="50px" />
<img class="do-force " src="x.png" alt="ALT" width="50px" height="50px" />
<br>
<img class="do-force " src="x.png" />
<img class="do-force " src="x.png" width="50px" />
<img class="do-force " src="x.png" height="50px" />
<img class="do-force " src="x.png" width="50px" height="50px" />
<br>
<img class="do-force min-width" src="x.png" alt="ALT" />
<img class="do-force min-width" src="x.png" alt="ALT" width="50px" />
<img class="do-force min-width" src="x.png" alt="ALT" height="50px" />
<img class="do-force min-width" src="x.png" alt="ALT" width="50px" height="50px" />
<br>
<img class="do-force min-width" src="x.png" />
<img class="do-force min-width" src="x.png" width="50px" />
<img class="do-force min-width" src="x.png" height="50px" />
<img class="do-force min-width" src="x.png" width="50px" height="50px" />
<br>
<img class="do-force min-height" src="x.png" alt="ALT" />
<img class="do-force min-height" src="x.png" alt="ALT" width="50px" />
<img class="do-force min-height" src="x.png" alt="ALT" height="50px" />
<img class="do-force min-height" src="x.png" alt="ALT" width="50px" height="50px" />
<br>
<img class="do-force min-height" src="x.png" />
<img class="do-force min-height" src="x.png" width="50px" />
<img class="do-force min-height" src="x.png" height="50px" />
<img class="do-force min-height" src="x.png" width="50px" height="50px" />
<br>
<img class="do-force min-width min-height" src="x.png" alt="ALT" />
<img class="do-force min-width min-height" src="x.png" alt="ALT" width="50px" />
<img class="do-force min-width min-height" src="x.png" alt="ALT" height="50px" />
<img class="do-force min-width min-height" src="x.png" alt="ALT" width="50px" height="50px" />
<br>
<img class="do-force min-width min-height" src="x.png" />
<img class="do-force min-width min-height" src="x.png" width="50px" />
<img class="do-force min-width min-height" src="x.png" height="50px" />
<img class="do-force min-width min-height" src="x.png" width="50px" height="50px" /> img { margin: 1rem; }
.min-width { min-width: 100px; }
.min-height { min-height: 100px; }
.do-force { -moz-force-broken-image-icon: 1; }
.no-force { -moz-force-broken-image-icon: 0; } as we can see, the PS: but I think the statement is correct that the |
I just had a read through again, and I don't think it's right. Let's recap:
The You can have a look at the preview here: https://pr37261.content.dev.mdn.mozit.cloud/en-US/docs/Web/CSS/-moz-force-broken-image-icon#css Where:
I think a better note might be that the alt text may not be visible if the image width and height are not large enough. Do you agree? |
@@ -55,7 +55,7 @@ img { | |||
{{EmbedLiveSample('Examples','125','125')}} | |||
|
|||
> [!NOTE] | |||
> Unless the image has a specified height and width the alt attribute will not be displayed if `-moz-force-broken-image-icon` is set to `1`. | |||
> If `-moz-force-broken-image-icon` is set to `1`, the `alt` attribute will not be displayed if the image has a specified height or width. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> If `-moz-force-broken-image-icon` is set to `1`, the `alt` attribute will not be displayed if the image has a specified height or width. | |
> Alt text may not be visible if `-moz-force-broken-image-icon` is set to `1` and an image has no (or too small) `height` or `width` set. |
before: if height and width is set
after: if height or width is set
Description
moz-force-broken-image-icon specified, that alt text will not be shown if height and width is set. Changed it to an or.
And reworded sentence to make it simpler to read; converted alt to
alt
.Motivation
the wiki talks about "has a specified height and width"
but it should be an "or" as showcased by this playground
specifically look at the second to fourth line / image.
Additional details
Related issues and pull requests