SitePoint Sponsor

User Tag List

Page 3 of 3 FirstFirst 123
Results 51 to 75 of 75
  1. #51
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    or… any unordered list that is a descendant of a element classed as nobullet.

  2. #52
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    To be specific, it means that an ancestor of the <ul> has a class of nobullet. It can be the parent, a grandparent, a grand-grandparent, etc.
    so who are the parent, grandparent and great grandparent of the <ul> ? Im not kidding.

  3. #53
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,623
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    If you have this markup
    Code:
    <div>
    <p>
    <ul class="nobullet">
    ...
    </ul>
    </p>
    </div>
    Not very good markup, just an example.

    <div> would be the grandparent of <ul>. <p> would be the parent. Understand where I am going?
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  4. #54
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,623
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Aarem View Post
    How do you refer to your own grandparents then? Mom and Dad?
    I call them granny and graddy.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  5. #55
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BoltZ View Post
    Not very good markup, just an example.

    <div> would be the grandparent of <ul>. <p> would be the parent.
    No, not very good markup at all.

    A <ul> cannot be a child of a <p>, since lists are block-level elements.

    Code HTMl4Strict:
    <body>
      <div>
        <ul>...</ul>
      </div>
    </body>

    The body element is the ancestor of all the other elements, and the parent of the div. It's the grandparent of the ul.

    The div is an ancestor and the parent of the ul. It's also a child and a descendant of body.

    The ul is a child of the div and a descendant of the div and of body. It's a grandchild of body.
    Birnam wood is come to Dunsinane

  6. #56
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,623
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Yes, I said it wasn't good markup but I thought of the first tags that came to mind, essentially the theory is still the same
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  7. #57
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Paragraph is a block level element so it could. I wouldn't advise it, but it is valid.

  8. #58
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    The code written by BoltZ is not valid. The reason why it is not valid is that there is a closing paragraph tag </p>, but no open paragraph. It is not invalid because of the unordered list being inside the paragraph, as this is not actually the case.

    When an unordered list tag <ul> comes after an open paragraph tag <p>, the paragraph tag is automatically closed. Therefore, an unordered list can never be the child of a paragraph.

    The following code contains the code originally written by BoltZ, with comments on how the code would be read by the parser (more or less, anyway), with the document tree added.
    Code html4strict:
    <div><!-- A div begins here. [div] -->
      <p><!-- A paragraph begins here. [div - p] -->
        <ul><!-- An unordered list. An unordered list can't fit inside a paragraph, so the paragraph must have ended imediately prior to the unordered lidt. Also, an unordered list begins here. [div - ul] -->
        </ul><!-- The unordered list ended here. [div] -->
      </p><!-- A closing tag for a paragraph. How very odd - I can't find any records of an open paragraph. Oh well, the author probably wrote it by mistake, so I'll just ignore it. [div] -->
    </div><!-- The div ended here [] -->
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!

  9. #59
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    Paragraph is a block level element so it could. I wouldn't advise it, but it is valid.
    No, it's not. Paragraph elements can only contain text and inline elements. The declaration in the DTD is,
    Code:
    <!ELEMENT P - O (&#37;inline;)*>
    Where %inline; is a parameter entity reference that expands to a sequence of #PCDATA or one of the inline element types.

    Unordered lists are block-level, so they cannot be children of a paragraph.
    Birnam wood is come to Dunsinane

  10. #60
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,623
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    As said before it was just an example to show what ancestors of elements are. I in no way say that it is valid or that I recommend using it. How about this.

    Code:
    <body>
    <ul>
    <li>sdf</li>
    </ul>
    </body>
    There, use that code to bash.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  11. #61
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    pg. 115 of Build your own website the right way then is incorrect. It explicitly states that a paragraph element is a block level element. Maybe that has been corrected in the newer version.

    I've never had need to care, but could you supply the link where you got this information?

  12. #62
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Paragraph elements are themself block-level elements, but they can contain only inline elements. The container and contents are not the same thing.

    <!--================== HTML content models ===============================-->

    <!--
    HTML has two basic content models:

    &#37;inline; character level elements and text strings
    %block; block-like elements e.g. paragraphs and lists
    -->

    <!ENTITY % block
    "P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
    BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">

    <!ENTITY % flow "%block; | %inline;">
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  13. #63
    SitePoint Addict Aarem's Avatar
    Join Date
    Aug 2008
    Posts
    245
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BoltZ View Post
    I call them granny and graddy.
    OK, so just refer to granny and graddy elements on this forum, and we'll understand you.

  14. #64
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    So its untrue then that block level elements can contain other block level elements becasue a paragraph is a block level element that is not allowed to contain block level children?

  15. #65
    SitePoint Wizard silver trophybronze trophy
    Join Date
    Jul 2008
    Location
    New York, NY
    Posts
    1,432
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    So its untrue then that block level elements can contain other block level elements becasue a paragraph is a block level element that is not allowed to contain block level children?
    Paragraphs are the exception. When marking up a paragraph, you will not have any block level elements within. Paragraphs should be viewed as a container for long spans of text usually consisting of 2+ sentences. Nested within p tags, mostly you should see:
    1. span tag
    2. strong tag
    3. em tag
    4. q tag
    5. cite tag
    and so on...

    To this day, I will see the occasional p wrapped around a division or something rather strange like that.

    There are instances where the p tag can be used to mark up images:
    1. When the longdesc attribute is used.

    There is a huge debate on whether or not p tags can properly convey meaning to images.

    I am pretty sure in the HTML5 spec that p tags may contain other block level elements. I'm not 100&#37; positive though.

  16. #66
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    It's pretty easy to look up and find out.

    Here is I think the quote that's responsible.

    http://www.w3.org/html/wg/html5/#paragraphs
    The p element can be used to wrap individual paragraphs when there would otherwise not be any content other than phrasing content to separate the paragraphs from each other.
    This doesn't mean that a paragraph element can contain another paragraph element. It means that the paragraph element is uses to separate two pieces of phrasing content. For example:

    Code html4strict:
    This is the <em>first</em> paragraph in this example.
    <p>This is the second.</p>

    The content model for the p element in HTML5 is still set as "phrasing content" which are not block-level elements.

    There is also controversy over the div element element. Some are saying that div elements should contain only block-level elements, and I'm tempted to agree with them.

    Allowing div elements to contain phrasing content makes it easy for authors to abuse div, using it with the class="" attribute to the point of not having any other elements in the markup. This is a disaster from an accessibility point of view, and it would be nice if we could somehow make such pages non-compliant without preventing people from using divs as the extension mechanism that they are, to handle things the spec can't otherwise do (like making new widgets).
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  17. #67
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BoltZ View Post
    As said before it was just an example to show what ancestors of elements are.
    I understand, but it's still wrong.
    Since the </p> tag may be omitted, <p><ul>...</ul></p> is actually the same as <p></p><ul>...</ul>. The HTML parser can infer the </p> since it knows an <ul> cannot be a child of a paragraph. The </p> tag after the list is an error and will be ignored.

    So in your example, the paragraph and the unordered list would be siblings, not parent and child.

    Quote Originally Posted by oddz View Post
    pg. 115 of Build your own website the right way then is incorrect. It explicitly states that a paragraph element is a block level element.
    A paragraph element is a block-level element.

    Quote Originally Posted by oddz View Post
    So its untrue then that block level elements can contain other block level elements
    Some block-level elements, like blockquote and form, can only contain block-level children in the Strict DTDs.

    Some block-level elements, like p and pre, can only contain text and inline-level children.

    Some block-level elements, like div, can contain both inline and block-level children, although it's not semantically sensible to mix them.
    Birnam wood is come to Dunsinane

  18. #68
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    That is interesting. Guess I really haven't had the need to care because I never place block level elements inside a paragraph tag anyway. Thanks for clearing that up though.

  19. #69
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,623
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Aarem View Post
    OK, so just refer to granny and graddy elements on this forum, and we'll understand you.
    Alright will do.

    Guess I really haven't had the need to care because I never place block level elements inside a paragraph tag anyway. Thanks for clearing that up though.
    What about
    <div><p>text</p></div>?
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  20. #70
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BoltZ View Post
    What about
    <div><p>text</p></div>?
    That's a paragraph inside a block-level element, not a block-level element inside a paragraph.
    Birnam wood is come to Dunsinane

  21. #71
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,623
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    But <p> is a block level element so technically it's a block level element inside a block level element.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  22. #72
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by BoltZ View Post
    But <p> is a block level element so technically it's a block level element inside a block level element.
    As artistic cuckoo said, some block-level elements are allowed to contain other block-level elements, it's mandetory in some cases, and not allowe din others.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  23. #73
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Artistic?!
    Birnam wood is come to Dunsinane

  24. #74
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,707
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Off Topic:

    Yes, artistic was a slip of the mind that indicates on some level how I feel about your skills
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  25. #75
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cooper.semantics View Post
    I am pretty sure in the HTML5 spec that p tags may contain other block level elements. I'm not 100% positive though.
    HTML5 used to allow lists and tables in <p>, but that would only work in XHTML. The content models in HTML5 changed quite a bit about a year ago, to be more like HTML 4.01 Transitional.

    Content model:
    Phrasing content.
    http://www.whatwg.org/specs/web-apps...#the-p-element
    Simon Pieters


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •