display:none how FF is not conforming to W3C

Discussion in 'CSS' started by alexuser333, Jun 29, 2010.

  1. #1
    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?
     
    alexuser333, Jun 29, 2010 IP
  2. browntwn

    browntwn Illustrious Member

    Messages:
    8,347
    Likes Received:
    848
    Best Answers:
    7
    Trophy Points:
    435
    #2
    try it and see. :)



    it seems to work when I use it.
     
    browntwn, Jun 29, 2010 IP
  3. alexuser333

    alexuser333 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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
     
    alexuser333, Jun 29, 2010 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    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
     
    kk5st, Jun 29, 2010 IP