-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Image alignment in figure is not centered when image smaller than figcaption #6731
Comments
@squidfunk, does this text in the admonition in the section on image aligment mean that people should expect images in figures with captions are centered?
This is not default HTML behaviour, so should be more explicitly said that the CSS does this. The mechanism, I assume is the It seems possible to use an empty caption to center an image that does not really need a caption. This seems to come out with a hight of zero but still has a space on the screen. Might that interfere with other things? Once the issue is fixed, can we take the bit about centering images that have a caption out of the admonition? It seems too common a use case to hide it away. What I do to center images is to add extra css. I assign images a class with attribute lists and set the width of the image to something like 80% and then define margins along these lines. |
So, it's right that the content of the figure itself is currently not centered. I suppose that until now, users have only used images that are larger than the figure, which then gets shrunk via aspect ratio. I agree that the expected behavior for smaller images is certainly that the image is centered nonetheless, so we should change that in our CSS. |
Fixed in 5b9bcb1. |
Released as part of 9.5.7. |
https://build.opensuse.org/request/show/1144834 by user dirkmueller + anag+factory - skip build for python 3.12 - update to 9.5.8: * Added Tamil translations * Updated Esperanto translations * Fixed relative images not being resolved for instant navigation - update to 9.5.7: * Fixed #6731 <squidfunk/mkdocs-material#6731>: Small images in figures are not centered * Fixed #6719 <squidfunk/mkdocs-material#6719>: Instant navigation breaks table of contents (9.5.5 regression)
Context
No response
Bug description
Creating a
figure
with an image that is smaller than the width of thefigcaption
prevents the image from being center aligned?Related links
Reproduction
figure-center-bug.zip
Steps to reproduce
mkdocs serve
http://127.0.0.1:8000/
Browser
No response
Before submitting
The text was updated successfully, but these errors were encountered: