[thelist] [css] display:none

Diego Barcia webmaster at sci-web.com.ar
Tue Nov 5 04:41:00 CST 2002


Sorry, I messed up in the previous message. Netscape 4 does not support
those methods, I'm so used now to write the same code for 5+ browsers that I
forgot completely NS4. I don't code for it anymore (don't ask me why I just
think it's useless, unless on the users community where I am from). The
correction of the code is:

if (document.layers) {
var Layer = document.layers['Message'];
Layer.style = 'hidden';
}

or just

document.layers['Message'].style.visibility = 'hidden';

or something like that...

I'm not absolutely sure of it though. Any JavaScript DHTML help from other
members of the list would be appreciated...

regards,
Diego-


----- Original Message -----
From: "Diego Barcia" <webmaster at sci-web.com.ar>
To: <thelist at lists.evolt.org>
Sent: Tuesday, November 05, 2002 7:18 AM
Subject: Re: [thelist] [css] display:none


> Hi,
>
> > Trouble is that the div still pushes my content down, so I have had to
> adjust the padding of my other (visible) page content. I was under the
> impression that if i set it to display:none, and made it absolutely
> positioned (thus taking it out of page flow) it would not affect the
visible
> portions of page content.
>
> I think the css property 'display' refers always to an element that is on
> the page flow of the document, thus the values 'block' or 'inline', they
> point to something that is relative to the flow, otherwise 'inline' and
> 'block' would be equivalent to the 'visible' value of the visibility
> property and there will not be any difference between them also. I think
> using 'display' along with CSS-P or absolute positioning creates a CSS
> conflict that could produce unexpected results. I'm not a css know-it-all
> but I think that you could use the visibility property for the
> absolute-positioned layer, which was the original purpose of that property
> (separating DHTML Layers logic from page flow), and was first introduced
in
> NS4. Via JavaScript you can set this property getting the node of that
DIV,
> perhaps with 'document.getElementByID(LayerID)', and appending to that
node
> object, the following predefined properties: style.visibility = 'visible'.
> 'hidden' is the keyword for hiding the layer, and 'visible', the one for
> displaying it. NS4 support this, and using it will avoid HTML graphic or
> structural problems. Perhaps, if you need to show the layer or div only in
> NS4, you could do and object detection in order to detect NS4 and only
that
> browser, and if that evaluates to true, you could show the layer:
>
> [if the layer has the id 'Message']
> if (document.layers) { // check if it is NS4; NS6 doesn't support this, so
> you're safe
> var Layer = document.getElementById('Message');
> Layer.style.visibility = 'visible'; }
>
> (this is one of the cases where we can see that not keeping JS backward
> compatibility is'nt that bad)
>
> And in the CSS stylesheet, set initially the visibility of that layer to
> 'hidden':
> #Message {
>     visibility: hidden; } etc
>
> The JavaScript code must be executed after the page is loaded, otherwise
the
> parser would not be able to find a tag with that id before the body of the
> document loads, throwing an error.
>
> regards,
> Diego.
> http://sci-web.com.ar
>
>
>
>
>
>
>
>
>
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>




More information about the thelist mailing list