Click to See Complete Forum and Search --> : Hiding text in a <div>


deltareum
06-05-2003, 03:20 PM
I need to place some text in a <div></div> area of a document, but I need the text to be invisible (because a script on the page needs to read it at some time). How do I do that? I am using IE. I can make no assumptions about background colors and such (so making it the same color as the background won't work).

Thanks.

Deltareum

DaveSW
06-05-2003, 03:44 PM
how about:

<span style="display:none;">all hidden content</span>

or put it in the div tag to hide the whole div

dave

brendandonhue
06-05-2003, 03:50 PM
<div id="mydiv" style="visibility:hidden">

DaveSW
06-05-2003, 03:53 PM
deltareum: the difference between these is that display:none will not display the text, so it won't affect the layout. visibility:hidden hides it, so it will alter your layout.

(I couldn't remember the value for visibility offhand which was why i didn't post it)

dave

deltareum
06-05-2003, 04:24 PM
Thanks! You people are the greatest!

I am using <div style="display:none;"> now and it works like a champ.

What versions of IE and Netscape will this work with?

Deltareum

nkaisare
06-05-2003, 04:38 PM
What versions of IE and Netscape will this work with?
IE4+, NS4+
However, both insert a blank line.

IE5+ and NS6+ do not insert a blank line (which is appropriate behavior)

Robert Wellock
06-06-2003, 07:42 AM
M$ IE 6.0 fails and inserts a blank line under some circumstances, when it shouldn't the same went for Opera 6.0 but in Opera 7.xx the problem was resolved.

So M$ has buggy support for display:none;.