-
Notifications
You must be signed in to change notification settings - Fork 715
[css-shapes] Consider adding shape-outside: line-box #4003
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
Comments
This would also be useful as a clip-path, making it easier to create a reliable ragged background effect. |
It might be useful to add something to https://drafts.csswg.org/css-inline-3/#inline-box-dimensions for the ragged background effect. It currently defines the block-oriented sizing of the line box's content area. We could add inline-oriented sizing controls there as well (which might then affect the clip-path and shape-outside bounds for the value proposed here) |
@MatsPalmgren you could do that one with |
@faceless2 Oh, I didn't know that. You're right, it looks like initial-letter-wrap:all address that use case. |
Thanks for pointing to that one @faceless2 - now if only we could get browsers to implement initial-letter. So far Safari is the only one, and only partially at that :( |
Perhaps it could be generalized to all floats by adding something like that to |
I agree there's a definite requirement here - To me it this looks like yet another place where the requirement is "take a rendered DOM fragment and use the rendering as input to the layout or rendering of another DOM element". I listed a few of these in #1981, and as I suggested there, I'd personally like to see all these consolidated under the This would mean In other words, I don't see any reason why you couldn't do this: <style>
#floated {
shape-outside: url(#floated);
float: left;
width: 10em;
}
</style>
<div id="floated">Such a very strange odyssey indeed</div> shape-outside doesn't affect the layout of the element it's set on, so there's no dependency loop here. |
@faceless2 But why do we need the ID in that case? It's a self-reference, couldn't we make it a keyword so that you can set it on a set of elements at once? |
For this individual case? Sure, great idea - |
I'd like to propose adding a new value to the
shape-outside
property ofline-box
. This would enable floating a title or other block of text and allowing text to wrap around it following the contour of that floated text. It would operate in a similar manner toshape-outside: <image>
when the image has an alpha-channel transparency. It should also leverageshape-margin
attributes as well.While it's possible to achieve this using a
polygon
shape, addingline-box
would mean it would work with any text rather than having to be custom-coded.Examples

Here is a CodePen example using
shape-outside: <polygon>
to mimic the effect:https://codepen.io/jpamental/pen/LovYov
Here is a real-world example that is a bit more responsive:
https://rwt.io/blog/2018/10/georgia-my-mind
Shape-outside spec
https://drafts.csswg.org/css-shapes/#shape-outside-property
The text was updated successfully, but these errors were encountered: