...

View Full Version : Very strange problem with dreamweaver



Ge64
12-15-2006, 09:12 AM
I have this bit of code:


<td class="menubody"><p><ul>
<li>Homepage</li>
<li>Blog</li>
<li>Downloads</li>
<li>Pictures</li>
</ul></p></td>

And I save it, and when i open the page in FF, and look at the sourcecode, it says:


<td class="menubody"><p></p><ul>
<li>Homepage</li>
<li>Blog</li>
<li>Downloads</li>
<li>Pictures</li>
</ul></td>

As you can see, the <p>tags are.. misplaced! How did it do that? It's not that it doesnt save correctly because i'm sure I never put in <p></p> anywhere...

croatiankid
12-15-2006, 01:10 PM
It's because UL is a block level element, and inline elements (like P) cannot contain block level elements. You are probably using an XHTML DOCTYPE, in which case all tags (including P) must be closed, so the P is automatically closed. If you check out http://www.croatiankid.com/design.php, you'll see that before my UL I have a P, and it appears that the P is not closed anywhere, and therefore doesn't validate, but because of the DOCTYPE I used, the P is automatically closed before the UL, except here you can't see it closed because in HTML Ps don't have to be closed (I think...), but I still close it wherever I need, like on the other pages of the site.

croatiankid
12-15-2006, 01:12 PM
Also, because of what I explained above,
<td class="menubody"><p><ul>
<li>Homepage</li>
<li>Blog</li>
<li>Downloads</li>
<li>Pictures</li>
</ul></p></td>
would not validate, because the P would automatically close itself in the browser before the UL, and the /P would be redundant (unneccessary, since the P is actually already closed)

VIPStephan
12-15-2006, 10:21 PM
It's because UL is a block level element, and inline elements (like P) cannot contain block level elements.

It's true that inline elements cannot contain block elements, however, a paragraph is a block element as well. Only they can't contain lists, which the internal validator of Dreamweaver should tell you if you validate.
It might be that you have some kind of code correction enabled so Dreamweaver will automatically correct wrong code (hence, close a paragraph that wrongly contains a list).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum