473,526 Members | 2,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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?
Jul 20 '05 #1
9 6830
On Wed, 26 May 2004 05:38:40 +0300, Akseli Mäki
<ne********@spam.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.
Jul 20 '05 #2
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...

--
Bertrand Mollinier Toublet
closity = 1.0 / farthitude
-- Arthur J. O'Dwyer
Jul 20 '05 #3
On Tue, 25 May 2004 20:33:13 -0700, Bertrand Mollinier Toublet
<be*****************************@enst-bretagne.fr> wrote:
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...
Jul 20 '05 #4
Neal wrote:
On Wed, 26 May 2004 05:38:40 +0300, Akseli Mäki
<ne********@spam.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
Jul 20 '05 #5
In article <r6********************************@4ax.com>,
Akseli Mäki <ne********@spam.akseli.net> writes:
the subject say quite a lot. I have about the following code(4.01
transitional):

<p>blaa blaa blaa
<ul>

And validator says it says "end tag for element "P" which is not open". I


Feed that into the Visual Validator view at Page Valet, and all becomes
much clearer. It'll show you the document tree (including the implied </p>)
with errors and warnings highlighted where they arise.

--
Nick Kew

Nick's manifesto: http://www.htmlhelp.com/~nick/
Jul 20 '05 #6
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.
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?
Jul 20 '05 #7
On Wed, 26 May 2004 16:49:49 +0300, Akseli Mäki
<ne********@spam.akseli.net> wrote:
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.
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.

Jul 20 '05 #8
Akseli Mäki <ne********@spam.akseli.net> wrote:
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

Jul 20 '05 #9
"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message
news:Xn*****************************@193.229.0.31. ..
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.
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4647
by: bearclaws | last post by:
I am looping through a list of categories and want to display the list horizontally (instead of vertically). I want to create a single row with 4 list items in each cell of the row. I thought this would work but I get this error: "End tag 'xsl:if' does not match the start tag 'ul'." Any thoughts?
4
2200
by: abs | last post by:
Anybody has an idea how to get the <ul> element which is not nested in <li> element ? In other words I have several lists like this: <ul id="1"> <li>Aaaaaaaa</li> <li>Bbbbbbbb</li> <li>Cccccccc <ul> <li>111111</li> <li>222222</li>
2
7618
by: Shaun | last post by:
Hello! I have a quick question regarding CSS and having it applied to all elements. I am trying to eliminate the gap between a paragraph and a list that usually occurs in html and I've found away to do that with this code: <p>a</p> <ul style="margin-top: -20; padding-top: 0"> <li>1</li>
4
2809
by: opt_inf_env | last post by:
Hello, I have the following part of code sentence_1 <ul> <li> sentence_2 </ul> And I would like to decrease distance between sentence_1 and
11
5156
by: namenotgivenhere | last post by:
My design goal is to make the white space above and below <p> and <ul> equal to the height of my font. The first step to achieving this I believe is to have an equal amount of white space above or below <p> and <ul>. Can someone suggest a method using css to accomplish this? I have succeeded in doing this in IE6 but I'd also like to know if...
5
4470
by: Syl | last post by:
Hello experts!! The top menu navigation bar displays perfectly in IE, but does not display properly in Mozilla or Netscape : http://checkeredshirt.com/textonly.html For some reason the non-IE browers are forcing the top navigation menu to dislpay "staggered" after the the first <ul><lielement. Can anyone see why this is happening ?
6
4460
by: capricious | last post by:
Is it possible, so that when you do multiple <UL>'s to control how deep the UL's are marked? For example, it would defaultly look like this with multiple ULs and LIs: -- Code : Main Menu<ul>Fruits<ul><li>Apples</li><li>Oranges</li></ul></ul> .. -- Returns :
7
5886
by: turnernm | last post by:
error: document type does not allow element "ul" here; missing one of "object", "ins", "del", "map", "button" start-tag what i wanted in my site was to float an img to the left and a list to the right. this is what i ended up doing to get it to work: <style type="text/css"> ul {float:left;padding-left:100px;} img {float:left;} </style>
1
3713
by: Chinsu | last post by:
<html> <head> <style> #ex { width: 700px; background: red; float: left; } a, span { display: block;
0
7476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7234
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3314
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1702
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
888
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
549
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.