Forum Moderators: open

Message Too Old, No Replies

How to get blank lines in ordered lists?

<br /> not allowed in XHTML 1.0 transitional?

         

JayCee

6:46 pm on Jul 20, 2004 (gmt 0)

10+ Year Member



Hi All,

I would like to format ordered (numbered) lists with 2nd paragraphs having a blank line and no number. In other words, break up long numbered paragraphs into more than one paragraph for the same "index" number.

This doesn't seem to validate, when i use a <br /> between paragraphs. Seems <br /> are not allowed within <ol> </ol>.

Any ideas?
Should i be asking in the CSS forum?
This problem is within a CSS styled page.

[jc edit to set email notify on]

Span

6:58 pm on Jul 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This will work:

<li>text</li>
<li>text<br />
&nbsp;</li>
<li>text</li>

tedster

7:01 pm on Jul 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I get your need clearly, you can add more margin-top to each <li> tag. Probably the most semantically correct approach:

ol li {margin-top:2em;}

I believe you can also add a <br />&nbsp; WITHIN the <li> element, but not between two <li> elements.

JayCee

7:28 pm on Jul 20, 2004 (gmt 0)

10+ Year Member



Thanks guyz! That was easy.

All i had to do to get paragraphs in an ordered list with a blank line in-between them and no new number, was to put that <br /> inside the <li> </li> tag pair, instead of outside them (with or without the &nbsp; non-breaking space, of course).

And that CSS does give good spacing control inside lists.

..semantically correct..

BTW tedster, i often see this word "semantics" used in connection with web page coding best practices, but i don't understand what is meant by that?

:)

killroy

7:30 pm on Jul 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



semantics=meaning. The semantics of something is it's meaning.

<br> and <p></p> look similar, but their meaning/semantics are different. <br> is an arbitrary break without meaning, while <p>paragraph</p> Is a section of text marked as a paragraph.

Therefore the use of <br> is strongly discouraged, because <br> has littel semantic significance. And since HTML is a mark-up language, NOT a styling language, it's really only there to define the semantics of a document.

SN

JayCee

8:18 pm on Jul 20, 2004 (gmt 0)

10+ Year Member



Thanks killroy - i see now.

killroy

12:00 am on Jul 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just to recap, in my opinion, this:

<li>text</li>
<li>text<br />
&nbsp;</li>
<li>text</li>

should be this:

<li>text</li>
<li style="margin-bottom:1em">text</li>
<li>text</li>

Or alternately:

<li>text</li>
<li><p style="margin-bottom:1em">text</p></li>
<li>text</li>

Of course with the styles placed where appropriate.

SN

katana_one

12:24 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



I think this is what you are after. This uses no <br> tags and , I think, is semantically correct. No additional CSS information is necessary. Note: I did not check to see if this validates, but I don't beleive it will be a problem.

<ol>
<li>
<p>This is the first paragraph of list item number one.</p>

<p>This is the second paragraph under list item number one</p>
</li>

<li>
<p>This is a paragraph for list item number two.</p>
</li>
</ol>

[edited for clarity]

katana_one

2:14 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



By the way, I just validated the code I posted above as XHTML 1.0 Strict via the validation service at w3schools.com.