Click to See Complete Forum and Search --> : display:none for any element except one


said_fox
06-02-2008, 03:41 PM
Hello,

I have a web page and it is linked to a css file. In this page I have an element (fieldset) and It is given the id RepCont.

I want to make, display none for any other elements in another linked css file for priniting the page, allowing only RepCont to be displayed.

I want doing this regardless what other elements are i.e their tags name, classes or ids. I just want make the printer media to see the element of id RepCont.

I tried the following, but it seems very stupid idea:


@charset "utf-8";
/* CSS Document */
body{display:none}
#RepCont {display:block;}


However, I need your ideas!

Centauri
06-02-2008, 06:47 PM
Try :* {display:none;}
#RepCont {display:block;}

said_fox
06-02-2008, 07:00 PM
Hi,

It does not work!

Centauri
06-02-2008, 08:23 PM
This would depend very much on the structure of the page. If #RepCont is contained within any other elements, then they too would need to be displayed - probably better off hiding all the elements you don't want displayed by listing those elements (separated by commas) in one rule.

said_fox
06-02-2008, 08:27 PM
Yes,
RepCont is a part of table's cell.

This prove that table based layout causes some problems!