W3C home > Mailing lists > Public > www-style@w3.org > April 2010

Re: Display

From: Markus Ernst <derernst@gmx.ch>
Date: Tue, 27 Apr 2010 16:43:12 +0200
Message-ID: <20100427144312.189150@gmx.net>
To: Colt Antonio Pini <Colt.Pini@nau.edu>, www-style@w3.org
-------- Original-Nachricht --------
> Datum: Mon, 26 Apr 2010 14:03:03 -0700
> Von: Colt Antonio Pini <Colt.Pini@nau.edu>
> An: "www-style@w3.org" <www-style@w3.org>
> Betreff: Display

> 
> I don't know if this is the correct place to put this but it seems the
> most correct that I can find. If it is not I would be happy to go where 
> it needs to go if I just knew where.
> 
> I am a designer/developer and have run into this problem many times in 
> the display attribute. Specifically speaking of C# and VS but also in 
> general with validation.
> 
>  It seems the convention to show / hide a validation tag is to change the
> inline style from display:none; to display:inline; This seems accurate
> enough because most validation is inline, but occasionally I have needed 
> to add a display: block; to the element. When I need to do that the 
> inline display overrides my block display. Putting a !important in the 
> stylesheet will override the display:none;
> 
> I mention this because it seems that it would be an appropriate value for
> the display attribute. Would there be a display: default; ? The
> functionality would be to have an element revert back to the default 
> display, for example. If I have a <p> the default would be block. There 
> is a little more to the functionality which might make default not an 
> appropriate keyword. So maybe this could be two values. Default 
> and 'defined' (this can be changed of course) The second would take the 
> last defined value, for instance if I had a <span> the default being 
> inline, I could define a display block in the stylesheet, then in the 
> inline style I would be able to say display: defined; and it would 
> render the way the stylesheet defined the element to display, if there 
> is no display definition the element would use the default display.
> 
> I hope that makes sense.

>From my authoring experience I think that this does indeed make sense. I sometimes ran into this problem, when using a generic show/hide function in Javascript. I found it worked if I used an empty string for the default:

function showHide(elementId, mode) {
  var el = document.getElementById(elementId);
  el.style.display = mode == "show" ? "" : "none";
}

Anyway, I did not find a specification for this, so I am not sure if this is supposed to work like that in every UA. And for sure, a "default" keyword would be more intuitive.

Also, I like the idea of a 'defined' keyword to reset the value from the stylesheet. This, of course, should then apply not only to the display property, but to all properties that can be changed by a script.
-- 
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/chbrowser
Received on Tuesday, 27 April 2010 14:43:47 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:26 GMT