![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi, the subject say quite a lot. I have about the following code(4.01 transitional): p>blaa blaa blaa ul li><a href="foo.html">foo</a></li li><a href="bar.html">bar</a></li /ul blaa /p And validator says it says "end tag for element "P" which is not open". I find this a bit strange. If I haven't explictly ended the <p> tag then how can the <ul> tag end it? Damn I want to say where it ends. Are there any other tags that can end other tags as well? |
#2
| |||
| |||
|
|
If you're up to it, read through the DTD and see which elements can contain what kinds of elements. It's enlightening. And hard. But worth it. If you want to know what you're doing, you'll have to make it through it someday. |
#3
| |||
| |||
|
|
Neal wrote: If you're up to it, read through the DTD and see which elements can contain what kinds of elements. It's enlightening. And hard. But worth it. If you want to know what you're doing, you'll have to make it through it someday. Right. Although I'd recommend to start with the spec itself (http://www.w3.org/TR/html401) and only then graduate to the DTD. Without some background, I am afraid the DTD might a little, mmh, terse... |
#4
| |||
| |||
|
|
On Wed, 26 May 2004 05:38:40 +0300, Akseli Mäki newsgroups (AT) spam (DOT) akseli.net> wrote: Hi, the subject say quite a lot. I have about the following code(4.01 transitional): p>blaa blaa blaa ul li><a href="foo.html">foo</a></li li><a href="bar.html">bar</a></li /ul blaa /p And validator says it says "end tag for element "P" which is not open". I find this a bit strange. If I haven't explictly ended the <p> tag then how can the <ul> tag end it? Damn I want to say where it ends. Are there any other tags that can end other tags as well? Basically: p cannot contain ul, so once ul comes along, p has to close implicitly. If you're up to it, read through the DTD and see which elements can contain what kinds of elements. It's enlightening. And hard. But worth it. If you want to know what you're doing, you'll have to make it through it someday. |
#5
| |||
| |||
|
|
Neal wrote: Basically: p cannot contain ul, so once ul comes along, p has to close implicitly. Ok. That's not exactly the way I would like it to be, though. |
Sounds to me you want div instead of p, and CSS it up to look|
If you're up to it, read through the DTD and see which elements can contain what kinds of elements. It's enlightening. And hard. But worth it. If you want to know what you're doing, you'll have to make it through it someday. Well, ever since I started writing HMTL I've had a local copy of the defination. I published my first homepages in 14th of June 2001. But that doesn't make me a expert in any way, since my HTML is very simple. On the defination of <p> tag it says "It cannot contain block-level elements (including P itself)." It has a link but I couldn't find a list of the elements that are block-level. So where exactly can I find information about this particular thing, what elements can contain what other elements? |
#6
| |||
| |||
|
|
On the defination of <p> tag it says "It cannot contain block-level elements (including P itself)." It has a link but I couldn't find a list of the elements that are block-level. So where exactly can I find information about this particular thing, what elements can contain what other elements? |
#7
| |||
| |||
|
|
By the way, the elements that may lack an end tag in HTML 4 are: /body>, </colgroup>, </dd>, </dt>, </head>, </html>, </li>, </option>, /p>, </body>, </td>, </tfoot>, </th>, </thead> ja </tr>. This follows from the DTD. However, it has always been good practice to close all elements explicitly. For example, p>foo<table>... is by HTML 4 specification just a shorter form of writing p>foo</p><table>... but browsers have been observed to treat them differently (e.g., by not leaving a margin below the p element). |
![]() |
| Thread Tools | |
| Display Modes | |
| |