-
Notifications
You must be signed in to change notification settings - Fork 669
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
[css-align] Apply align-content to replaced elements #4545
Comments
Note that (https://drafts.csswg.org/css-cascade/#computed)
Since the condition only checks the computed value, it seems that |
@MatsPalmgren Content alignment requires adding space inside the element, but replaced elements don't have internal CSS layout. So I'm unsure how they could be participating? Certainly they can participate in self-alignment, but that's a different thing. |
Added "non-replaced" to the description of when baseline alignment applies, so at least there's no confusion on the image grid item case. |
First, talking about elements in this context makes no sense, since CSS layout is based on boxes. Second, "adding space" here refers to increasing the padding and images certainly have padding, for example: <img style="border:1px solid; padding:30px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAMCAIAAAD3UuoiAAAAGklEQVQoz2Nk%2BP%2BfgRqAiYFKYNSgUYOGp0EA%2BQMCFrJdTgsAAAAASUVORK5CYII%3D"> So why exactly shouldn't |
So what you're asking, is not about baseline alignment specifically, but to have |
I will note that replaced elements do already have the |
Huh, I... did not realize that padding worked on images. Makes sense, I guess, since padding is outside the content area.
That does appear to be it, yes.
I think there's a reasonable interaction here - object-* properties still just size/align the content within the content box, but the *-content properties would effectively apply "magic padding" to align the content box as specified. |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: css-align] Apply align-content to replaced elements #4545<dael> github: https://github.com//issues/4545 <dael> TabAtkins: Mats wants the content alignment prop to apply to replaced elements. It adds magical padding. Replaced elements ca have padding on them. Easy theoretical model there's nothing wrong with having content alignment work. <dael> TabAtkins: Seems fine to me. We hadn't thought of it. Similar to object fit and position, but separable because this adjusts outside content box <dael> TabAtkins: I'm fine adding this in. Want to make sure; check temp of group <dael> fantasai: Size of replaced element when not stretched? <dael> fantasai: In order to align something within something need size of container and thing being aligned. Know container. Size of thing being aligned what's the size? <dael> TabAtkins: intrinsic of content <dael> fantasai: Is that useful? What does it mean if something w/o intrinsic size <dael> TabAtkins: Stuff w/o intrinsic doesn't work. How useful, I don't know. Works in the model <tantek> does this actually enable any new use-cases that aren't already solved by object-fit etc.? <dael> fantasai: It's possible, but I don't know if it's useful. If not useful why do we spend time to define. What new use cases does this enable? Gotta do something or not worth effort. <tantek> right if it's not useful (new use-cases, or great simplification of existing use-cases), we should not do it <fantasai> s/define/define and test and implement/ <dael> TabAtkins: Unless anyone has ideas perhaps push back until we get a use case. Looking over issue from Mats there isn't one <tantek> I'd leave the issue open to allow gathering of new use-cases <dael> jensimmons: Wondering what reason was to file issue <dael> dholbert: Might be easier to have it work than add an exception <tantek> or ways to simplify existing use-cases. I trust mats had something in mind <dael> Rossen_: If we don't know the reasoning it's a fair ask to go back and se what he replies with. <dael> Rossen_: If it's pure theory it's one thing but if there's actual use cases...grid is a common layout that's being used more and more with replaced content for various image and media presentation. Ideally he'll have an example <dael> Rossen_: Let's continue in the issue |
@MatsPalmgren CSSWG discussed your suggestion (see above), but we didn't see any strong use cases. So for the moment, it doesn't seem worth the implementation and testing effort to make this work. If there are significant use cases you have, or others have, we're open to considering them, though. |
The spec for align-content says:
An image is not a block container, nor any of the other containers listed.
So, per those definitions,
align-content:baseline
does not apply to an<img>
grid item.However, the spec for Baseline Content-Alignment says for Grid items:
A strict reading of the spec implies that Baseline Content-Alignment does not apply to an
<img>
grid item since thealign-content
property doesn't even apply to images. Is this is the intention of the spec? I see no particular reason why images, for example, shouldn't be allowed to participate in baseline alignment usingalign-content:baseline
.The text was updated successfully, but these errors were encountered: