Milano wrote:
Hi, I was wondering if it's possibel to hide the tag body and, after
this, show some tag (eg. a div) inside the body element.
After testing I'm quite sure It doesn't work by using "normal" ways.
I guess the "normal" way you are referring to consists of setting body {
display: none } and then setting display: block for the specific element
(using an id selector, for example). It is normal to use display: none to
remove an element from rendering (it by definition causes the page to be
rendered as if the element were there not at all, as opposite to other ways
of hiding elements, which may affect some forms of rendering only). But by
definition, it won't work the way you tried (and many people, including me,
have tried):
"Descendant elements do not generate any boxes either; the element and its
content are removed from the formatting structure entirely. This behavior
*cannot* be overridden by setting the 'display' property on the
descendants."
http://www.w3.org/TR/CSS2/visuren.html#display-prop
The problem: I have a page with various tags. In the printed version,
only a div will be printed. I know how to hide all the other
elements, by using their ids, but maybe there is another way.
It is usually best to hide other elements. In most cases, it suffices to
group all content before the element into a single div and all content after
it into another, and then the styling is simple.
If you cannot do that (e.g., if the markup is not suitable for that and you
cannot affect the markup), then you could resort to other methods of hiding.
For example, you could absolutely position the body element far far away and
set overflow: hidden on the html element, and you would then absolutely
position the element that shall be displayed, placing it so that it appears
"normally". As it will be positioned within the framework of the body
element, you would need a stylesheet like
html { overflow: hidden }
body { position:absolute; left: 10000em }
#foo { position:absolute; left:-10000em; top:0}
</style>
This has the potentially serious drawback overflow: hidden may hide some of
the content that must not be hidden...
Yucca
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/