Are there good reasons to bind a paragraph to a list item?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
keuler
Propeller Head
Posts: 63
Joined: Sun Sep 20, 2009 2:54 pm

Are there good reasons to bind a paragraph to a list item?

Post by keuler »

Hi. After importing from RoboHelp, I see that my unordered lists have a paragraph tag bound to them, eg:

Code: Select all

<ul>
            <li class="Bullet_01">
                <p>Text here.</p>
            </li>
            <li ....
What are the benefits of this construction. That is, why not just define a li style with the desired paragraph/text attributes. Only one use case occurs to me: Adding multiple paragraphs under one bullet. Are there any others?

Thanks.

-Kurt
(Flare CSS newbie)
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: Are there good reasons to bind a paragraph to a list ite

Post by doc_guy »

This construct is preferred if you want to add images in the same list item as text, and is essentially required if you want to use a "Note" or "Warning" style in the middle of an ordered or unordered list. Additionally, you don't have to create a bunch of different LI styles to achieve this effect.

Finally, I think it is important to remember that the semantic construction of your underlying HTML is especially important for disabled users who use screen-reading software to read them the contents of a web page. When everything that is tied together as part of the same step is part of the same LI, it makes semantic sense, and is understandable to those who can't see the document.

What is really cool is that with CSS selectors you can actually target paragraphs inside an LI, so you can modify paragraph settings just for paragraphs inside a list. For example:

Code: Select all

p {
     color:blue;
}

li p {
     color:red;
}
In this case, all paragraphs are blue, and all paragraphs that are child elements of an LI element are red. You've achieved different styles for paragraphs without the need for any paragraph classes. Nifty, huh?!
Paul Pehrson
My Blog

Image
keuler
Propeller Head
Posts: 63
Joined: Sun Sep 20, 2009 2:54 pm

Re: Are there good reasons to bind a paragraph to a list ite

Post by keuler »

OK thanks Paul!
Psider
Propellus Maximus
Posts: 822
Joined: Wed Jul 06, 2011 1:32 am

Re: Are there good reasons to bind a paragraph to a list ite

Post by Psider »

Just to state the obvious, if you just need a simple list then there is no need of the p tag.

e.g.

1. Eggs
2. Milk
3. Flour
4. Lemon
5. Sugar

(Also, as a slight diversion, it's moderately hard to create lists in Robohelp without p tags, but also not easy to include multiple paras inside the list item as Paul recommends. I much prefer Flare's flexibility in this case. :) )
Post Reply