Connecting Tech Pros Worldwide Forums | Help | Site Map

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

lawrence
Guest
 
Posts: n/a
#1: Jul 23 '05
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>

Rijk van Geijtenbeek
Guest
 
Posts: n/a
#2: Jul 23 '05

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


On 1 Oct 2004 10:01:53 -0700, lawrence <lkrubner@geocities.com> wrote:
[color=blue]
> 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>[/color]

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
Darin McGrew
Guest
 
Posts: n/a
#3: Jul 23 '05

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


lawrence <lkrubner@geocities.com> wrote:[color=blue]
> 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>[/color]

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, darin@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)
Michael Stemper
Guest
 
Posts: n/a
#4: Jul 23 '05

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


In article <da7e68e8.0410010901.18a813c9@posting.google.com >, lawrence writes:[color=blue]
>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:[/color]

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?

Neal
Guest
 
Posts: n/a
#5: Jul 23 '05

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


On 1 Oct 2004 10:01:53 -0700, lawrence <lkrubner@geocities.com> wrote:
[color=blue]
> <p>
> <h5>My title</h5>
> <ul>
> ...
>
> <p>
> <h5>habits</h5>
> <ul>
> ...[/color]

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.
John Dunlop
Guest
 
Posts: n/a
#6: Jul 23 '05

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


lawrence wrote:

[ ... ]
[color=blue]
> Can I do this:
>
> <p>
> <h5>My title</h5>
> <ul>
> <li>books</li>
> <li>dogs</li>
> </ul>
> </p>[/color]

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
lawrence
Guest
 
Posts: n/a
#7: Jul 23 '05

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


Darin McGrew <mcgrew@stanfordalumni.org> wrote in message news:<cjk326$lmr$1@blue.rahul.net>...
[color=blue]
> 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>[/color]

Do nested lists cause any well-known problems in major browsers that I
should know about?
lawrence
Guest
 
Posts: n/a
#8: Jul 23 '05

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


mstemper@siemens-emis.com (Michael Stemper) wrote in message news:<200410011748.i91HmjV28002@mickey.empros.com> ...[color=blue]
> In article <da7e68e8.0410010901.18a813c9@posting.google.com >, lawrence writes:[color=green]
> >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:[/color]
>
> 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>[/color]

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?
lawrence
Guest
 
Posts: n/a
#9: Jul 23 '05

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


Neal <neal413@yahoo.com> wrote in message news:<opse7deg0y6v6656@news.individual.net>...[color=blue]
> On 1 Oct 2004 10:01:53 -0700, lawrence <lkrubner@geocities.com> wrote:
>[color=green]
> > <p>
> > <h5>My title</h5>
> > <ul>
> > ...
> >
> > <p>
> > <h5>habits</h5>
> > <ul>
> > ...[/color]
>
> 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.[/color]

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.
Neal
Guest
 
Posts: n/a
#10: Jul 23 '05

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


On 1 Oct 2004 17:08:49 -0700, lawrence <lkrubner@geocities.com> wrote:
[color=blue]
> 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.[/color]

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.
Neal
Guest
 
Posts: n/a
#11: Jul 23 '05

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


On 1 Oct 2004 17:06:25 -0700, lawrence <lkrubner@geocities.com> wrote:

[color=blue]
> 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?[/color]


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?
Toby Inkster
Guest
 
Posts: n/a
#12: Jul 23 '05

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


John Dunlop wrote:[color=blue]
> lawrence wrote:
>[color=green]
>> Can I do this:
>>
>> <p>
>> <h5>My title</h5>
>> <ul>
>> <li>books</li>
>> <li>dogs</li>
>> </ul>
>> </p>[/color]
>
> No[/color]

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

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

John Dunlop
Guest
 
Posts: n/a
#13: Jul 23 '05

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


Toby Inkster wrote:
[color=blue]
> http://examples.tobyinkster.co.uk/crazy-nesting[/color]

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
lawrence
Guest
 
Posts: n/a
#14: Jul 23 '05

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


Are forms allowed inside of UL tags? Can a form be a list item?
Neal
Guest
 
Posts: n/a
#15: Jul 23 '05

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


On 4 Oct 2004 19:31:07 -0700, lawrence <lkrubner@geocities.com> wrote:
[color=blue]
> Are forms allowed inside of UL tags? Can a form be a list item?[/color]

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.
Lauri Raittila
Guest
 
Posts: n/a
#16: Jul 23 '05

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


In article <da7e68e8.0410011605.72ccb044@posting.google.com >,
lkrubner@geocities.com says...[color=blue]
> Darin McGrew <mcgrew@stanfordalumni.org> wrote:[color=green]
> > 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>[/color]
>
> Do nested lists cause any well-known problems in major browsers that I
> should know about?[/color]

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>
Lauri Raittila
Guest
 
Posts: n/a
#17: Jul 23 '05

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


In article <da7e68e8.0410041831.743c55b@posting.google.com> ,
lkrubner@geocities.com says...[color=blue]
> Are forms allowed inside of UL tags?[/color]

Not directly. But ul can be inside form.
[color=blue]
> Can a form be a list item?[/color]

Yes.

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

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Closed Thread