469,271 Members | 1,466 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

is it acceptable to put a UL inside of a paragraph??

I have a list of lists, and each lists has a heading. I want the
heading to be grouped with its list. Can I do this:

<p>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</p>

<p>
<h5>habits</h5>
<ul>
<li>dancing</li>
<li>lauging</li>
</ul>
</p>
Jul 23 '05 #1
16 38665
On 1 Oct 2004 10:01:53 -0700, lawrence <lk******@geocities.com> wrote:
I have a list of lists, and each lists has a heading. I want the
heading to be grouped with its list. Can I do this:

<p>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</p>


No. The P element only allows inline elements. Browsers will treat the
above
as:

<p></p>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>

Why use the P at all in such a case?

Here is a nice tutorial on HTML basics:

http://www.htmlhelp.com/reference/html40/

--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen
Jul 23 '05 #2
lawrence <lk******@geocities.com> wrote:
I have a list of lists, and each lists has a heading. I want the
heading to be grouped with its list. Can I do this:

<p>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</p>


No. The P element cannot contain block-level elements like H5 and UL. It
can contain only inline (text-level) elements.

But since this is "a list of lists", you can nest lists:

<ul>
<li>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</li>
...
</ul>
--
Darin McGrew, da***@TheRallyeClub.org, http://www.TheRallyeClub.org/
A gimmick car rallye is not a race, but a fun puzzle testing your
ability to follow instructions. Upcoming gimmick car rallye in
Silicon Valley: Monstah Mash 2004 (Saturday, October 2)
Jul 23 '05 #3
In article <da**************************@posting.google.com >, lawrence writes:
I have a list of lists, and each lists has a heading. I want the
heading to be grouped with its list. Can I do this:


No, but this looks to me like it's made to order for a DIV. Try this:

<div id="Title">
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</div>

<div id="Habits">
<h5>habits</h5>
<ul>
<li>dancing</li>
<li>lauging</li>
</ul>
</div>

--
Michael F. Stemper
#include <Standard_Disclaimer>
If it's "tourist season", where do I get my license?

Jul 23 '05 #4
On 1 Oct 2004 10:01:53 -0700, lawrence <lk******@geocities.com> wrote:
<p>
<h5>My title</h5>
<ul>
...

<p>
<h5>habits</h5>
<ul>
...


You've gotten good responses, but I want to point out something different.

Are you choosing h5 doe to its rendering on screen or because it's really
the fifth most important heading on the page? Generally, we assign one h1
to a page, sections of the page get h2, and sub-sections h3. h5 would
therefore be used for a sub-sub-subsection. In practice, h4, h5 and h6 are
rare, rarer, and rarest, respectively.

This is not an HTML rule per se, but simply a good practice for organizing
content for UAs which might do a table of contents automatically based on
headings, for example. h5 might actually be totally appropriate, but
consider this.

If the method of choosing the heading I suggest leads you to a heading
that doesn't look right to you on screen, use CSS to alter the rendering.
Jul 23 '05 #5
lawrence wrote:

[ ... ]
Can I do this:

<p>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</p>


No; since, as others wrote, P elements may contain only
inline elements. That answers the question in the
Subject line as well.

http://www.w3.org/TR/html4/struct/text.html#h-9.3.1

Unfortunately in my book, this and similar excerpts are
invalid:

<P>My hobbies are
<UL>
<LI>dancing and</LI>
<LI>jumping rope.</LI>
</UL>I like laughing too.</P>

The list is part of the paragraph, but in HTML there's
no markup for lists inside paragraphs. Instead we might
stuff the list between two paragraphs:

<P>My hobbies are</P>
<UL>
<LI>dancing and</LI>
<LI>jumping rope.</LI>
</UL>
<P>I like laughing too.</P>

Sometimes, as in my example, what is marked up as a
paragraph is not a paragraph, even in the loosest sense
of the word. Would DIVs be more appropriate then? One
DIV or two?

HAGW!

[ ... ]

--
Jock
Jul 23 '05 #6
Darin McGrew <mc****@stanfordalumni.org> wrote in message news:<cj**********@blue.rahul.net>...
But since this is "a list of lists", you can nest lists:

<ul>
<li>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</li>
...
</ul>


Do nested lists cause any well-known problems in major browsers that I
should know about?
Jul 23 '05 #7
ms******@siemens-emis.com (Michael Stemper) wrote in message news:<20***********************@mickey.empros.com> ...
In article <da**************************@posting.google.com >, lawrence writes:
I have a list of lists, and each lists has a heading. I want the
heading to be grouped with its list. Can I do this:


No, but this looks to me like it's made to order for a DIV. Try this:

<div id="Title">
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</div>

<div id="Habits">
<h5>habits</h5>
<ul>
<li>dancing</li>
<li>lauging</li>
</ul>
</div>


Wouldn't it have more semantic meaning if I made it a list of lists,
with UL's nested inside of other ULs, as another poster suggested?
Jul 23 '05 #8
Neal <ne*****@yahoo.com> wrote in message news:<op**************@news.individual.net>...
On 1 Oct 2004 10:01:53 -0700, lawrence <lk******@geocities.com> wrote:
<p>
<h5>My title</h5>
<ul>
...

<p>
<h5>habits</h5>
<ul>
...


You've gotten good responses, but I want to point out something different.

Are you choosing h5 doe to its rendering on screen or because it's really
the fifth most important heading on the page? Generally, we assign one h1
to a page, sections of the page get h2, and sub-sections h3. h5 would
therefore be used for a sub-sub-subsection. In practice, h4, h5 and h6 are
rare, rarer, and rarest, respectively.


I've trouble ranking all the info on the page. How much of the detrius
of logos, template links and icons, and results information should be
given a weight in the ranking? I stumble on questions like this. I was
thinking that this info was the 5th most important on the page, but I
could also turn around and say all the headers should be h2. Hard to
judge.
Jul 23 '05 #9
On 1 Oct 2004 17:08:49 -0700, lawrence <lk******@geocities.com> wrote:
I've trouble ranking all the info on the page. How much of the detrius
of logos, template links and icons, and results information should be
given a weight in the ranking? I stumble on questions like this. I was
thinking that this info was the 5th most important on the page, but I
could also turn around and say all the headers should be h2. Hard to
judge.


Consider how your page would look if it was old-school - just paragraphs,
headings, lists, and links and other necessary inline markup. No
modern-looking layout (whether table-based or CSS), no images (!), no
script, no nothing. The answers will be easier to find that way.

In fact, I author my page that way to start, using hierarchical headings
and paragraphs, lists, etc. Once it is finalized, I then add images
(replacing content the image duplicates, as needed), add any needed
scripting (which will never need to be there for the page to work), apply
CSS to layout the page, change what the headings look like as needed, etc.
etc. In the no-CSS environment, the page degrades to something quite
usable. And of course, in the CSS environment it (ideally) looks pretty
much like you expected.
Jul 23 '05 #10
On 1 Oct 2004 17:06:25 -0700, lawrence <lk******@geocities.com> wrote:

Wouldn't it have more semantic meaning if I made it a list of lists,
with UL's nested inside of other ULs, as another poster suggested?

That's up to you. I think headings are fine. Nested lists are fine too -
and to answer your question elsewhere, I know of no problems with them in
any browser.

You have to make the call - is it a list of lists, or is it a series of
unrelated lists which fall under seperate headings?
Jul 23 '05 #11
John Dunlop wrote:
lawrence wrote:
Can I do this:

<p>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</p>


No


.... but: http://examples.tobyinkster.co.uk/crazy-nesting

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jul 23 '05 #12
Toby Inkster wrote:
http://examples.tobyinkster.co.uk/crazy-nesting


Crazy, crazy nesting!

Another ungodly alternative is the underrated MAP
element. Being always rendered, and valid under
Strict, it surpasses the nastiness of the NOSCRIPT
and APPLET hacks.

'It validates, but that doesn't mean you should do
it!' says it well.

HAGS! what's left of it.

--
Jock
Jul 23 '05 #13
Are forms allowed inside of UL tags? Can a form be a list item?
Jul 23 '05 #14
On 4 Oct 2004 19:31:07 -0700, lawrence <lk******@geocities.com> wrote:
Are forms allowed inside of UL tags? Can a form be a list item?


According to the DTD, the acceptable contents of LI and DD are %flow which
means nearly anything goes. DT can contain only inline, however.

So, you can put form inside li.
Jul 23 '05 #15
In article <da**************************@posting.google.com >,
lk******@geocities.com says...
Darin McGrew <mc****@stanfordalumni.org> wrote:
But since this is "a list of lists", you can nest lists:

<ul>
<li>
<h5>My title</h5>
<ul>
<li>books</li>
<li>dogs</li>
</ul>
</li>
...
</ul>


Do nested lists cause any well-known problems in major browsers that I
should know about?


Yes. Some Opera versions forgot to add list item marker on li that
contained other lists directly. With above code, no problem

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 23 '05 #16
In article <da*************************@posting.google.com> ,
lk******@geocities.com says...
Are forms allowed inside of UL tags?
Not directly. But ul can be inside form.
Can a form be a list item?


Yes.

<ul><li><form...>...</form></li></ul>

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 23 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Amir Hardon | last post: by
1 post views Thread by Jason Quinn | last post: by
22 posts views Thread by Firas | last post: by
8 posts views Thread by Jukka K. Korpela | last post: by
18 posts views Thread by Bryan Parkoff | last post: by
3 posts views Thread by gentsquash | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.