W3C home > Mailing lists > Public > www-style@w3.org > February 2008

Re: [CSS21] visibility: collapse on non-table elements

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Thu, 14 Feb 2008 09:23:15 -0800
Message-ID: <47B47903.7050600@terrainformatica.com>
To: fantasai <fantasai.lists@inkedblade.net>, www-style@w3.org

L. David Baron wrote:
> On Thursday 2008-02-14 02:03 -0800, fantasai wrote:
>> Specifically, block-level elements with "visibility: collapse" should behave as
>> if their box was zero height with zero vertical padding, border width, and margins,
>> and inline-level elements with "visibility: collapse" should behave as if their
>> box was zero width with zero horizontal padding, border width, and margins.
>> Furthermore all descendants of a non-internal-table-element with "visibility:
>> collapse"--including descendants that are anonymous boxes--are also treated as
>> if they had "visibility: collapse".
> Is there a compelling use case for this?  Do authors want it for
> some reason?  It's a good bit of work to implement, and it's not
> worth doing that work just to make the property semantics more
> aesthetically pleasing to spec designers.
> -David

Hi, David,

Reason is very simple and is widespread especially recently.

Dynamic show/hide of elements. Used in many circumstances in scripts and 
in static CSS declarations.

Example #1: I want to define shown/hidden state of .dependent all 
elements based on value of body[mode="foo|bar"] attribute:

body[mode="foo"] .dependent
   display: none; /* to hide */

body[mode="bar"] .dependent
   display: ???; /* what to put here to show arbitrary element so to 
discard display:none? */

Example #2: AJAX "devilopment", the same problem - we need some 
attribute that has single value for "shown" state.

var el = ...;
     el.style.display = "none"; // to hide
     el.style.display = "????"; // how exactly to define "show" ?

Search the web on 'style.display = "block"' phrase and you will get list 
of links. Almost every link there leads to potentially erroneous code.

Best regards,

Andrew Fedoniouk.

Received on Thursday, 14 February 2008 17:23:30 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:34 UTC