or… any unordered list that is a descendant of a element classed as nobullet.
| SitePoint Sponsor |
or… any unordered list that is a descendant of a element classed as nobullet.





If you have this markup
Not very good markup, just an example.Code:<div> <p> <ul class="nobullet"> ... </ul> </p> </div>
<div> would be the grandparent of <ul>. <p> would be the parent. Understand where I am going?
Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work

Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work


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

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
Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work
Paragraph is a block level element so it could. I wouldn't advise it, but it is valid.
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 [] -->


No, it's not. Paragraph elements can only contain text and inline elements. The declaration in the DTD is,
Where %inline; is a parameter entity reference that expands to a sequence of #PCDATA or one of the inline element types.Code:<!ELEMENT P - O (%inline;)*>
Unordered lists are block-level, so they cannot be children of a paragraph.
Birnam wood is come to Dunsinane

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.
There, use that code to bash.Code:<body> <ul> <li>sdf</li> </ul> </body>
Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work
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?


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:
%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
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% positive though.


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
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: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.
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


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.
A paragraph element is a block-level element.
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
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.

Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work



But <p> is a block level element so technically it's a block level element inside a block level element.
Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work


Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript


Off Topic:
Artistic?!![]()
Birnam wood is come to Dunsinane


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
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.
http://www.whatwg.org/specs/web-apps...#the-p-elementContent model:
Phrasing content.
Simon Pieters
Bookmarks