Per W3C, display:none as the following guidelines: "none This value causes an element to not appear in the formatting structure (i.e., in visual media the element generates no boxes and has no effect on layout). 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." but if in nest a div element in a p element and set p{display:none}, the div context will still be shown. Am I right?
here is my html file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <link rel="stylesheet" type="text/css" media="all" href="./test.css" /> <title> </title> </head> <body> <p> <div> divtext </div> </p> </body> </html> and my css file: p { display:none; } Can you please tell what I'm doing wrong. thanks alex
For one thing, you may not validly nest a div element within a p. Firefox is supplying the closing p tag, since p must be closed before opening the div. Therefore div is not descended from p. Firefox is doing this correctly. cheers, gary