Repository navigation
Show SVG images that have no width of their own - #219
Merged
Merged
Conversation
An SVG image whose file sets no width, such as one with only a viewBox or with width="100%", rendered at 0x0 and disappeared from the page. That holds for a block image, for an SVG embedded with an <object> tag for interactivity, and for inline SVG. Stretch a block image's content box to the full width of the block and align the image inside it with text-align, as upstream's fcb2110 does. An SVG without a width then fills the column in Chromium, WebKit and Firefox, and the text-left and text-right roles still align narrower images. Upstream also sizes an <object> SVG that has no width attribute with width: fit-content (f96f0fb), a rule docs-ui dropped in #61. It stays out: with the stretched content box it changes nothing in Chromium, and it shrinks such an SVG to the default object size in WebKit and to nothing in Firefox.
Contributor
|
UI bundle preview build successful! ✅ |
|
Build successful! ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An SVG image whose file sets no width of its own, such as one with only a
viewBoxor withwidth="100%", rendered at 0×0 and disappeared from the page. That held for a block image, for an SVG embedded with an<object>tag (opts=interactive) and for inline SVG.This adopts upstream's fcb2110: a block image's content box stretches to the full width of the block, and the image inside it is aligned with
text-align. An SVG without a width then fills the column, or the table cell it's in, in Chromium, WebKit and Firefox. Images that set a width, SVGs that declare their own size, and images with alignment roles or floats stay where they were.Upstream also sizes an
<object>SVG that has nowidthattribute withwidth: fit-content(f96f0fb), a rule docs-ui dropped in #61. It stays out: with the stretched content box it changes nothing in Chromium, while in WebKit it shrinks such an SVG to the default object size and in Firefox to nothing.site.css grows by 197 bytes, 25 bytes gzipped.