-
Notifications
You must be signed in to change notification settings - Fork 662
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-sizing-4] Does aspect-ratio work on the content box or the border box? #4007
Comments
It's pretty clear that replaced elements need to apply their intrinsic aspect ratio to the content box; and also that for non-replaced elements, we frequently want to size the border box instead. One possible way to do both is:
|
@dholbert also wrote regarding this topic:
|
The CSS Working Group just discussed
The full IRC log of that discussion<TabAtkins> Topic: Aspect Ratio<TabAtkins> fantasai: Question was, does aspect-ratio affect the calculations for content-box or border-box? Good question. <TabAtkins> fantasai: Images, intrinsic aspect ratio always affects the content box; to do otherwise would screw up the iamge. <TabAtkins> fantasai: But for non-replaced elements, not a great answer; often you want to a-r the border box, as that's the visible bounds of the element. <TabAtkins> fantasai: As a reminder, a-r has two values, "auto" which means there's no a-r unless you're a replaced element with an intrinsic ratio... <TabAtkins> fantasai: So our proposal is that with "auto" the intrinsic ratio is used, so we only affect the content box. <TabAtkins> fantasai: But if you give an explicit ratio, it affects whihicever box box-sizing says. <leaverou> q+ <dbaron> sounds good to me <TabAtkins> AmeliaBR: I want to read this carefully and see how it compares with how SVG behaves. <TabAtkins> AmeliaBR: I think your proposal is a good default. <leaverou> q- <heycam> github: https://github.com//issues/4007 <TabAtkins> AmeliaBR: I might come back with a request to be able to specify the box for the aspect ratio separate from box-sizing box. <TabAtkins> AmeliaBR: So might want to set the width of an element's border box, but still set a-r of the content box. <TabAtkins> florian: You want to investigate how much that idea would be needed? <TabAtkins> AmeliaBR: Yeah, I think fantasai's proposal will cover most cases. Might just need an addition. <TabAtkins> Rossen_: Unfortunate thing is there will be yet another % resolution that'll by cyclic. <TabAtkins> TabAtkins: It won't be a new one. <TabAtkins> AmeliaBR: a-r didn't use a %... <TabAtkins> Rossen_: Padding can be a % which is affected by the width which is affected by the height which is affected by the width... <TabAtkins> Rossen_: But let's go with it and see how it goes. <TabAtkins> fantasai: So do we want to accept the proposal? <TabAtkins> AmeliaBR: Already pushed a draft? <TabAtkins> fantasai: Yeah, and think there's a disposition of changes. <TabAtkins> Rossen_: Any objections? <TabAtkins> RESOLVED: Explicit a-r applies to whichever box the box-sizing property specifies. <tantek> +1 |
@dholbert wrote:
We need to be sure it's clear which box (content-box vs. border-box) the aspect ratio is used for sizing, especially for elements that have an explicit "box-sizing:border-box". I imagine the ratio should always control how an element's content box is sized, since I think that's how aspect ratios work with images... but we should be sure that's explicitly stated.
The text was updated successfully, but these errors were encountered: