Re: [css-overflow-clipping] would 'overflow: clip' affect the layout of surrounding elements?

On 13/10/2013 9:03 PM, Kang-Hao (Kenny) Lu wrote:
> There was a question of "why 'overflow: hidden' establishes BFCs"[1]
> asked a while ago on this list and it was revealed - because 'overflow:
> hidden' has an invisible scrollbar, a fact that I doubt more than 5% of
> all Web developers know, and a float should not intrude into a
> scrollable element or otherwise the interaction is complicated.

That is not what Boris says. He says that the scrolling UI is not 
provided but content is still scrollable programmatically [2].

> I've since wondered if we can have a 'overflow: hidden' equivalent that
> has no layout but painting effect (and that floats can intrude into it).

Can you clarify what you mean by no layout.

> Perhaps 'clip' was meant to achieve this but that property seems to
> already fail largely.

Clip only works with absolutely position elements.

<!DOCTYPE html>
<style type="text/css">
div {
   position: absolute;
   border: 10px solid silver;
   background: red;
   clip: rect(0px,60px,100px,0px);
}
</style>
<div>
<p>A line that is longer than what is clipped.</p>
<p>Another line.</p>
</div>


> Before reading into the draft, I thought this
> draft is about this, but the draft doesn't mention BFC...

Well I guess it should. I believe it's more to do with css-overflow 
being so incomplete.

> So... can we make 'overflow: clip' not establish a BFC, or is this
> already planned? The fact that 'overflow: hidden' affects layout is just
> really very confusing to Web developers. This behaivor has been the main
> way how Web developers get to known what a BFC is, I believe :)

If it doesn't create a BFC, then it's not a 'containing block'. Please 
read the spec [3] and note the use of the term 'containing block'.

  | In a block formatting context, boxes are laid out one
  | after the other, vertically, beginning at the top of
  | a containing block.

  | In a block formatting context, each box's left outer
  | edge touches the left edge of the containing block
  | (for right-to-left formatting, right edges touch).

The thing with overflow (usually a box with a set width or height) is 
that this 'containing block' (a rectangle) [4] overflows by overlapping 
other content (visible), overflows inside but can be scrolled (scroll) 
or is hidden but still scrollable programmatically.

> I don't know if spec-wise or implementation-wise not establing BFC
> contradicts the requirement to make the element a containling block
> root.

Are you referring to the initial containing block?

> If that's the case, I would like to requst another
> overflow-clipping value.
>
>
> [1] http://lists.w3.org/Archives/Public/www-style/2012Apr/thread#msg23
>
> Cheers,
> Kenny


[2] http://lists.w3.org/Archives/Public/www-style/2012Apr/0026.html
[3] http://www.w3.org/TR/CSS21/visuren.html#block-formatting
[4] http://www.w3.org/TR/CSS21/visuren.html#containing-block

Alan

-- 
Alan Gresley
http://css-3d.org/
http://css-class.com/

Received on Sunday, 13 October 2013 16:10:02 UTC