-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: hardcoded vertical alignment: bottom
makes it impossible to correctly align images
#69255
Comments
Hi @hanneslsm. I can take a look and try to reproduce the issue from my end. |
Where did you get this? As far as I've tested #69267,
There are three things to consider here:
Example theme.json{
"$schema": "../../schemas/json/theme.json",
"version": 3,
"styles": {
"typography": {
"lineHeight": "1.5"
}
}
}
Example theme.json{
"$schema": "../../schemas/json/theme.json",
"version": 3,
"styles": {
"typography": {
"lineHeight": "1.5"
},
"elements": {
"caption": {
"typography": {
"lineHeight": "2"
}
}
}
}
}
Example theme.json{
"$schema": "../../schemas/json/theme.json",
"version": 3,
"styles": {
"typography": {
"lineHeight": "1.5"
},
"blocks": {
"core/image": {
"typography": {
"lineHeight": "2"
}
}
}
}
} We need to find a way how to position images correctly while still respecting these scenarios. |
@coder-rancho What theme are you checking? Some themes may apply line-height to captions, others may not. |
You're right, I was using twenty-twenty-five theme. When I switched to empty theme, the line-height is removed. |
I've two fixes for this problem:
.wp-block-image {
&:not(:has(figcaption)) {
line-height: 0;
}
} Limitation: It'll not be supported by older browsers.
.wp-block-image {
line-height: 0;
figcaption {
line-height: normal;
}
} Limitation: It might override styles in theme. What do you suggest? I'll update #69267 with the suggested changes. |
I suggest a different approach: styling the |
That’s a great catch Aki. I checked the history of that and found it was added in #62556 which answered my question on why the Make
|
Thanks for the feedback! I don't have a strong opinion on whether P.S. I found one regression that might be related to this issue: #69316 |
Great catch Aki! Indeed it’s necessary. Just wanted to note that before #68666 merged, this issue was something only seen on the front end—the alignment in the editor was different. Now it’s the same which should avoid surprise. I still agree we should remove the
|
Description
In #35466 was the
vertical-align: bottom;
to all images introduced.The issue with this though is that when for example creating a header with a logo (image block) it's impossible to correctly align the logo in the middle aka with the rest of the block.
What it should be:

What it is:

It was only possible to create the "should be" example by adding the following code to my theme:
The vertical align of the image should take into consideration what the alignment settings of the enclosing row are.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Example Block Markup
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: