SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Zealot rhlowe's Avatar
    Join Date
    Sep 2006
    Location
    San Diego
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb Paragraphs and Unordered Lists

    (I couldn't decide if this thread was better suited for this forum or the Accessibility / Usability forum to please bear with me)


    Something I have been thinking about lately is the proper way to use p tags with ul tags.

    Generally, the way I would introduce an unordered list, or any list for that matter into a paragraph would be to close the paragraph, add the list, and then start a new paragraph, but it just dawned on me that does seem like the correct way of doing this, see example:

    HTML Code:
    <p>This is an interesting paragraph, huh? I'll introduce the list now:</p>
    <ul>
      <li>here</li>
      <li>is a</li>
      <li>list</li>
    </ul>
    <p>Please, let me finish talking about this list</p>
    From the viewpoint of semantics and common sense, wouldn't i be better to code the ul as a child of the paragraph, like this?

    HTML Code:
    <p>This is an interesting paragraph, huh? I'll introduce the list now:
      <ul>
        <li>here</li>
        <li>is a</li>
        <li>list</li>
      </ul>
    Please, let me finish talking about this list</p>
    Considering that, technically the list is part of the paragraph? Maybe I am the only person who coded using the former method, but I hope not and I hope that my reasoning, though bereft, is adequate to make my point and perhaps garner some discussion.
    San Diego Freelance Web Development Contractor
    Great Taste, no Filler. Now with no Trans Fat!

  2. #2
    \m/\m/ karinne's Avatar
    Join Date
    Dec 2002
    Location
    Aylmer, QC, Canada
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rhlowe
    From the viewpoint of semantics and common sense, wouldn't i be better to code the ul as a child of the paragraph, like this?

    HTML Code:
    <p>This is an interesting paragraph, huh? I'll introduce the list now:
         <ul>
           <li>here</li>
           <li>is a</li>
           <li>list</li>
         </ul>
       Please, let me finish talking about this list</p>
    I've always done it this way for the reasons you stated above (semantics and common sense). If it's wrong ... I'd like to know

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    technically, the list is not part of the paragraph (a P may contain only inline elements)

    so the first method is correct
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Zealot rhlowe's Avatar
    Join Date
    Sep 2006
    Location
    San Diego
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ^^^ ah-ha

    Well, you know what they say about conventional wisdom, or do you?

    Anyways, that was my next venue of search for a definitive answer, so thanks, I'll remain using the old method.
    San Diego Freelance Web Development Contractor
    Great Taste, no Filler. Now with no Trans Fat!

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A list doesn't make sense, semantically, within a paragraph. The validator will send death threats your way for the second method.
    Birnam wood is come to Dunsinane

  6. #6
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Death threats? I thought it only billed you for an arm, a leg, and your first born?

    But yeah, lists are not a part of a paragraph. Think about it. Would you expect to find a list inside a paragraph in a book or newspaper? Nope. Between them, yes. But never inside them.

  7. #7
    SitePoint Zealot
    Join Date
    Jul 2006
    Location
    Florida
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not valid xhtml to have a <ul> element contained within <p> tags.

  8. #8
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, it's not, because it doesn't make sense. That's what we've been trying to say in this thread.

    BTW, it's not valid HTML either.
    Birnam wood is come to Dunsinane

  9. #9
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can understand why some might think a list is part of a paragraph because a lot of times a list can be written inline and then it is part of the paragraph, e.g.:

    Please bring the following items: pen, pencil, paper and calculator.

  10. #10
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know, but that is taking it in absurdum. As with anything else, there are those who go overboard with 'semantics'. I've seen examples where people wanted to mark up a document as an ordered list of paragraphs.

    I'd say your example paragraph contains an enumeration, but not a real list.
    Birnam wood is come to Dunsinane

  11. #11
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In that case would it make sense to use:

    Code:
    <p>
    Please bring the following items:
    </p>
    <ul>
        <li>pen,</li>
        <li>pencil,</li>
        <li>paper</li>
        <li>and calculator.</li>
    </ul>
    I personally wouldn't do that and I'd just have it all as part of the paragraph but there doesn't seem to be anything technically wrong with that. You could even display the list inline if you wanted so that it displays as Tyssen has written it.

  12. #12
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    It depends wither it is an itemised list with an emphasized heading or a string of equipment separated by comma but loosely it could be one way but that looks nearer to string.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •