Skip to content

[css-overflow-4] where to clamp when a float pushes a whole line down #12817

@frivoal

Description

@frivoal

Given the following, what should happen?

<style>
.clamp {
  line-clamp: auto;
  max-height: 5lh;
  white-space: pre-wrap;
  width: 200px;
}
.float {
  float: left;
  width: 300px;
}
</style>
<div class="clamp">Line 1
Line 2
Line 3
Line 4
<div class="float">Float</div>Line 5
Line 6</div>

Currently, the spec allows clamp points in the following locations:

Line-clamp containers can have a clamp point, which is one of the following block-axis positions inside it:

Clearly, line 5 and 6 don't fit within the allocated height, and the float does, but is there a valid clamp point between "Line 4" and the float, or between the float and "line 5"? If there isn't, the latest clamp point that works would be between "line 3" and "line 4". That seems undesirable.

Is there something that falls out of the definition of floats (like this float being inside a line somehow, or there being a zero-width line next to it)? I'm not an expert, but I suspect not.

If not, to avoid the clamp point being between line 3 and 4, we probably want to add or tweak something to the list of possible clamp points above. But in that case, should we want clamp points to be allowed before or after the float (or both)? In a simple example like this one, it might seem that both/after the float would be preferable, but if the width of the element is filled not by one, but several floats of different heights (some going beyond the limit and some not), that seem a lot harder to handle, so maybe allowing the clamp point only before the float is preferable?

(this is based on line-clamp-auto-015.tentative.html, which should be updated depending on the conclusion here)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Tuesday afternoon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions