HighDots Forums  

Re: does <ul> tag end <p> tag? What about others?

HTML Writing HTML for the Web (comp.infosystems.www.authoring.html)


Discuss Re: does <ul> tag end <p> tag? What about others? in the HTML forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Neal
 
Posts: n/a

Default Re: does <ul> tag end <p> tag? What about others? - 05-25-2004 , 10:43 PM






On Wed, 26 May 2004 05:38:40 +0300, Akseli Mäki
<newsgroups (AT) spam (DOT) akseli.net> wrote:

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


Reply With Quote
  #2  
Old   
Bertrand Mollinier Toublet
 
Posts: n/a

Default Re: does <ul> tag end <p> tag? What about others? - 05-25-2004 , 11:33 PM






Neal wrote:
Quote:
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...

--
Bertrand Mollinier Toublet
closity = 1.0 / farthitude
-- Arthur J. O'Dwyer


Reply With Quote
  #3  
Old   
Neal
 
Posts: n/a

Default Re: does <ul> tag end <p> tag? What about others? - 05-25-2004 , 11:36 PM



On Tue, 25 May 2004 20:33:13 -0700, Bertrand Mollinier Toublet
<bertrand.mollinierNOSPAMtoublet (AT) enst-bretagne (DOT) fr> wrote:

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

You are certainly correct - I typed DTD meaning the spec. Though for many
there is no appreciable difference...


Reply With Quote
  #4  
Old   
Lachlan Hunt
 
Posts: n/a

Default Re: does <ul> tag end <p> tag? What about others? - 05-26-2004 , 04:32 AM



Neal wrote:
Quote:
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.
Reading the DTD might be a little hard for a beginner, as Akseli
appears to be.

Akseli, you should keep these links bookmarked, or print them out if you
like. Then, when you want to lookup whether an element can contain
another, or what attributes it has, or whatever else you want to know;
you can find by simply looking for the element name in either of these
indexes.

HTML 4.01 Index of Elements
http://www.w3.org/TR/html401/index/elements.html

XHTML 1.0
http://www.w3.org/TR/xhtml1/

XHTML 1.1
http://www.w3.org/TR/xhtml11/
XHTML 1.1 Document Type (Element List)
http://www.w3.org/TR/xhtml11/doctype.html#s_doctype

List of Valid DTDs
(Has a good template at the end to use)
http://www.w3.org/QA/2002/04/valid-dtd-list.html

HTML 4.01, XHTML 1.0 and 1.1 all contain essentially the same
elements, except XHTML 1.1 makes a few additions and changes that you
should be aware of [1 and 2]. I recommed avoiding the deprecated
elements and attributes, and try to stick to the XHTML 1.0 Strict DTD.


[1] http://www.w3.org/TR/xhtml11/changes.html
[2] http://www.w3.org/TR/2002/NOTE-xhtml...20801/#summary


Reply With Quote
  #5  
Old   
Neal
 
Posts: n/a

Default Re: does <ul> tag end <p> tag? What about others? - 05-26-2004 , 09:52 AM



On Wed, 26 May 2004 16:49:49 +0300, Akseli Mäki
<newsgroups (AT) spam (DOT) akseli.net> wrote:

Quote:
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.
Sorry. Sounds to me you want div instead of p, and CSS it up to look
how you like.

Quote:
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?
In a nutshell - any element that automatically goes to the left margin is
considered block-level. That's not precisely true, but it's a general
rule. In-line elements don't invoke a line break. They can go in p.



Reply With Quote
  #6  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: does <ul> tag end <p> tag? What about others? - 05-26-2004 , 01:46 PM



Akseli Mäki <newsgroups (AT) spam (DOT) akseli.net> wrote:

Quote:
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?
There are various resources on this, in books and elsewhere. There's a
practical, very useful presentation at
http://www.htmlhelp.com/reference/html40/alist.html
where each element is presented with "Contents" and "Contained in" lists.
And there's a different, somewhat confusing presentation of nesting rules
at http://www.cs.tut.fi/~jkorpela/html/nesting.html

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

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html



Reply With Quote
  #7  
Old   
C A Upsdell
 
Posts: n/a

Default Re: does <ul> tag end <p> tag? What about others? - 05-26-2004 , 03:15 PM



"Jukka K. Korpela" <jkorpela (AT) cs (DOT) tut.fi> wrote

Quote:
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).
And NN4 has been observed to go berserk.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.