hide contents of DIV

A

Andrew Poulos

I have a DIV element with a background image. The DIV is a container for
a number of other elements. Without iterating through the contents of
the DIV, is there a way to hide the contents and yet leave the
background image visible?

Is the background image considered part of the contents of a DIV?

Andrew Poulos
 
M

Matthias Reuter

I have a DIV element with a background image. The DIV is a container for
a number of other elements. Without iterating through the contents of
the DIV, is there a way to hide the contents and yet leave the
background image visible?

You could do so via CSS:

..hideChildren * {
visibility : hidden;
}

To hide all children of an element you simply have to add the class
hideChildren. Unfortunately this leaves text nodes visible, as long as
they are direct children. As a workaround you could move those into spans.

Matt
 
O

optimistx

Andrew said:
I have a DIV element with a background image. The DIV is a container
for a number of other elements. Without iterating through the
contents of the DIV, is there a way to hide the contents and yet
leave the background image visible?

Is the background image considered part of the contents of a DIV?

Andrew Poulos

What about creating another div under the first with the same background
image and size, but without elements?
 
A

Andrew Poulos

optimistx said:
What about creating another div under the first with the same
background image and size, but without elements?

Hmm, I like that suggestion. Thanks I'll try it.

Andrew Poulos
 
S

SAM

Le 9/8/09 12:12 PM, Andrew Poulos a écrit :
Is the background image considered part of the contents of a DIV?

I think : no
(the background will not fix the size of its support)

Image in background if in no-repeat wlll be cut if the element is
smaller than the image.
The background may be placed (marges)
intersting feature used in "slide-doors" concept (see Google).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top