-
Notifications
You must be signed in to change notification settings - Fork 671
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-inline-3] initial-letters: interaction of shape-margin and regular margin #5119
Comments
Maximum of the two values. The content-box size (and consequently the margin box size) is not influenced by |
Actually, thinking about this more... we've got several options here:
Only honoring (The additive option, having CC @dauwhe |
I think it's better to have an interaction between the properties rather than a switch where we only use one or the other. I think using the maximum is reasonable. Another possibility is to make things consistent with how shapes and margin boxes in floats interact - the shape described by shape-outside and shape-margin is clipped to the margin box. It's a bit weird for authoring, but once you learn how things are implemented for floats your knowledge would carry over to initial-letter. |
We've tried implementing Alan's suggested approach, and there's a slight problem. The spec states that when using Consider this: p::first-letter {
initial-letter: 3 3;
initial-letter-wrap: all;
shape-outside: 10px;
margin-right: 20px;
} The black "G" is the actual letter. The I think the best solution would be to not add the end margin+padding+border to the shape - i.e. remove "plus the amount of the initial letter’s end-side border+padding+margin." from the definiiton of In other words: the margin sets the margin-box, and does nothing else. The letter shape is expanded by This would be a change to the current functionality, but - as Webkit hasn't implemented I've put a demo of of the implementation as described in this comment at https://bfo.com/publisher/?saved/18c0fb7cb6c548f5#svg Edit: one consequence of this - currently you can set a negative margin to overlap the text. But |
Having shape-margin work exactly the same between floats and initial-letter seems like a good result to me. |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: initial letter shape-margin vs margin<fantasai> github: https://github.com//issues/5119 <emilio> faceless2: we have two ways of defining margin around an initial-letter, one is margin and the other is shape-outside <emilio> ... we need to define how they interact <emilio> ... I think I agree that matching what floats do is a good idea <emilio> ... there are a few proposals, not sure if fantasai's proposals are still applicable? <emilio> fantasai: there were several options, one is that we only used shape-margin only, another is using it when it's non-none, another is using maximum <emilio> faceless2: there's a strong argument I think to make it work the same ways as floats, may need to remove the margin-right magic <emilio> fantasai: one of the advantages of regular margin over shape-margin is that is axis-specific <emilio> ... so you can tweak the space with the following line by tweaking the margin only in the vertical axis <emilio> faceless2: I agree, current adding margin-right adds functionality that you can't reproduce in other ways <fantasai> s/vertical/horizontal/ <emilio> currently* <fantasai> s/axis/axis, for example. Using different amounts of margin between the initial letter and impacted lines vs between the initial letter and lines below it might make sense. You can't do that with shape-margin/ <emilio> astearns: so the downside of making it behave like floats is that you get the weird behavior that you can only pull stuff closer inside the margin box <emilio> ... and you need to expand the margin box if you want to push stuff further <emilio> ... but authors are dealing with that already <emilio> ... so probably they can deal with it too for initial-latter <emilio> fantasai: given the consistency argument we should probably spec this and see how it works and try to get some feedback <emilio> faceless2: nobody is shipping this currently right? Just WebKit? <emilio> fantasai: I think that's right, and WebKit's implementation is quite limited atm <emilio> RESOLVED: Make shape-outside and margin interact the same way for initial letters as for floats <emilio> astearns: as you spec this it may be that we should also move that over how floats behave |
@astearns / @faceless2 Mind reviewing the edits to make sure I got them right? 6b1e2a2 |
That change LGTM, thanks! |
@fantasai I'd put a paragraph break before "In both cases." Making it part of the second paragraph of the definition obscures the fact that it applies to the first paragraph as well. |
@astearns OK, done! Thanks for the review~ |
@fantasai as you're working on these.
Do we add the 20px margin to whatever the 10px margin around the shape is calculated to be at that point, or do we use the maximum of the two values?
We've implemented using the maximum of the two margins, which seems to work better - you can set
shape-margin
to ensure the shape isn't adhered to too closely, andmargin-right
to push the content along. This also makes more sense withinitial-letters-wrap: first
, where both properties apply to the first line but onlymargin-right
on subsequent lines.The text was updated successfully, but these errors were encountered: