473,837 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 40684
On 1 Oct 2004 10:01:53 -0700, lawrence <lk******@geoci ties.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******@geoci ties.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***@TheRallye Club.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_Discl aimer>
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******@geoci ties.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****@stanfor dalumni.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******@siemen s-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.in dividual.net>.. .
On 1 Oct 2004 10:01:53 -0700, lawrence <lk******@geoci ties.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******@geoci ties.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

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

Similar topics

6
2839
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 some one tell me what I'm doing wrong? it looks like this: var tbl=document.tbl; var frm=document.frm; var newcell=document.createElement("TD");
1
3188
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 below. How do I do this within XHTML and/or stylesheets? I've search for the answer but I get deluged with the same question in different contexts. Plus the responses have been so different that I don't know which are hack answers versus the "best"...
22
27260
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
3393
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 effectively, it'd have to be wrapped, correct? Thanks, - Michael
8
4421
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 markup in the sense that they don't apply the normal default top and bottom margins. This is rather odd, especially
18
8933
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 to create multiple functions which they look almost identical in C++ source code. The C++ compiler should be able to compile one Test() function into two almost identical functions before they are translated into the machine language object. ...
8
5138
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 within the second div the line moves into a different posistion. Without the p tag the text is displayed properly. Please help, it would be much appreciated. <body bgcolor="#999999"> <div id="content"> <div id="content-top-bar"><p>This text...
3
2321
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 http://www.math.ufl.edu/~squash/course.calc3.html
4
38405
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 have tried: var text = document.getElementById("test").value, also tried document.getElementById("test").firstChild but none of them return value of paragraph. where as in case of textarea i can access this value inside it by
0
9682
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10867
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10562
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10617
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
7803
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6989
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5842
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4036
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3122
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.