473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 40592
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Amir Hardon | last post by:
I'm new to DOM and can't figure out this thing: I'm trying to add a row to a table with a form field in one of it's cells, but if I'm appending the field to a form it gets out of the table. Can...
1
by: Jason Quinn | last post by:
This is an absurdly simple question. Suppose I have a paragraph which contains an image (of an equation) and I'd like the image to be centered in the middle of the paragraph with space above and...
22
by: Firas | last post by:
Hi, Is there a CSSish way to indent a paragraph except for the first line? I tried p:first-line { text-indent: 0em; }
40
by: | last post by:
Could someone cite some offical rule or documentation with regard to the <P> tag? I've seen folks put it in between paragraphs... and others wrap it around a paragraph. I'd think to use it...
8
by: Jukka K. Korpela | last post by:
I just noticed that most browsers render <table border="1"><tr><td><p>foo</p></td></tr></table> the same way as <table border="1"><tr><td>foo</td></tr></table> That is, they ignore the p...
18
by: Bryan Parkoff | last post by:
"#define" can only be inside the global scope before main() function. "#if" can be tested after "#define" is executed. The problem is that "#define" can't be inside main() function. I do not wish...
8
Markus
by: Markus | last post by:
I'm a new designer and pretty young - 16. I've recently encountered a problem with the paragraph tag inside a div. I have a div within a div (both with id selectors) when i place a paragraph tag...
3
by: gentsquash | last post by:
I'm trying to display a paragraph that has a centered phrase, such as this one, in the middle of the paragraph. An example is the section "End of semester project" on my course-page ...
4
by: rahullko05 | last post by:
i need to access the value of paragraph tag using dom in javascript. lets say there is <p id="test">this is test para </p> now how to access the value inside this para ie. "this is test para"? i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.