By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,867 Members | 1,964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,867 IT Pros & Developers. It's quick & easy.

Help with <ol>, <ul>, and <li>

P: n/a
This is a two-part question to which I haven't been able to find an answer
anywhere else.

1. Is it possible to format the bullet/number character of the <li>? In my
styles sheet, I have the <li> tag formatted, for example, bold. However,
when it's applied, the number of the <li> is not bold, but the text is. Do I
have to apply the bold to the <ol> instead?

2. When I use <li>example text</li>, and when I insert a <br> after the
</li>, the next paragraph of text appears on the same line as the </li> in
the _first line item only_. In subsequent lines, the following paragraph
appears on the next line where I want and expect it to. To correct this, I
have to use either a <p> or a double <br> to push the next paragraph down a
line.

Can I get some help with these?

I appreciate it.

Beck
Jul 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Thu, 6 May 2004 14:51:53 -0700, Michael <mr****@hotmail.com> wrote:
This is a two-part question to which I haven't been able to find an
answer
anywhere else.

1. Is it possible to format the bullet/number character of the <li>? In
my
styles sheet, I have the <li> tag formatted, for example, bold. However,
when it's applied, the number of the <li> is not bold, but the text is.
Do I
have to apply the bold to the <ol> instead?
Apply bold to the ol, yes, using CSS. You can then set li to font-weight:
normal if you want bold numbering but plain text.
2. When I use <li>example text</li>, and when I insert a <br> after the
</li>, the next paragraph of text appears on the same line as the </li>
in
the _first line item only_. In subsequent lines, the following paragraph
appears on the next line where I want and expect it to. To correct this,
I
have to use either a <p> or a double <br> to push the next paragraph
down a
line.


Use CSS to set a bottom margin of however many em to the li you want more
space below.

You're making the mistake of using <p> as a formatting tool. <p> means
"the following is a paragraph" and though most browsers will have a blank
line, there's no rule that says they must. I've heard that some browsers
ignore multiple <br>s as well.
Jul 20 '05 #2

P: n/a
Neal <ne*****@yahoo.com> wrote:
On Thu, 6 May 2004 14:51:53 -0700, Michael <mr****@hotmail.com> wrote:

1. Is it possible to format the bullet/number character of the <li>? In
my styles sheet, I have the <li> tag formatted, for example, bold. However,
when it's applied, the number of the <li> is not bold, but the text is.
Do I have to apply the bold to the <ol> instead?


Apply bold to the ol, yes, using CSS. You can then set li to font-weight:
normal if you want bold numbering but plain text.


Doesn't work. Browsers seem to treat the marker as part of the <li>
(at least for some properties) even though the relationship is rather
more complex in the spec.

Using a span (or whatever) around the contents of the <li> is the only
reliable way of giving the marker a different appearance in today's
browsers.
ol {font-weight: bold;}
li span {font-weight: normal;}

<ol>
<li><span>everything</li>
</ol>
cheers,
Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #3

P: n/a
Michael wrote:
Is it possible to format the bullet/number character of the <li>? In
my styles sheet, I have the <li> tag formatted, for example, bold.
However, when it's applied, the number of the <li> is not bold, but
the text is.
I thought they were formatted together. Url?
Do I have to apply the bold to the <ol> instead?
You could try that. If you want to format only the bullet, and not the
text, you have to add markup, but it sounds like you have a different
problem.
When I use <li>example</li>, and when I insert a <br> after the </li>
You have invalid markup, and there's no telling what a browser will do
when performing error-correction. The *only* element that can appear
inside <UL> or <OL> is <LI>.
the next paragraph of text appears on the same line as the </li> in
the _first line item only_.
We need a url. Something seems odd. What is the markup?
To correct this, I have to use either a <p> or a double <br> to push
the next paragraph down a line.


It's a bad idea to correct a visual artifact by hacking the html. First,
<P> markup is for paragraphs, not to "push things down." Second, there
is no real meaning to multiple <br> elements, so avoid that, too.
Instead, use css.

li { margin-bottom: 1em; }

I don't know exactly what you want; for a more detailed answer, please
provide the url of your test case.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #4

P: n/a
On Thu, 06 May 2004 23:10:41 +0100, Steve Pugh <st***@pugh.net> wrote:
Doesn't work. Browsers seem to treat the marker as part of the <li>
(at least for some properties) even though the relationship is rather
more complex in the spec.

Using a span (or whatever) around the contents of the <li> is the only
reliable way of giving the marker a different appearance in today's
browsers.
ol {font-weight: bold;}
li span {font-weight: normal;}

<ol>
<li><span>everything</li>
</ol>

Thanks for catching that, Steve.
Jul 20 '05 #5

P: n/a
In article <h9********************@giganews.com>, Michael writes:
2. When I use <li>example text</li>, and when I insert a <br> after the
</li>,
Are you saying that you're doing something like this:

<ol>
<li>example text</li>
<br>
<li>another example</li>
</ol>

If so, it's invalid HTML. The only thing that can be in a list is a
list item. Many browsers will try to guess what you mean by it, but
since it's not valid, their guesses aren't likely to agree.

the next paragraph of text appears on the same line as the </li> in
the _first line item only_.
You have paragraphs in your list, too? Something like this:

<ol>
<li>example text</li>
<br>
<p>The next paragraph of text</p>
<li>another example</li>
</ol>

You can't put paragraphs into a list, only list items. (I think that you
can put paragraphs into list items, but wouldn't swear to it.)

In subsequent lines, the following paragraph
appears on the next line where I want and expect it to. To correct this, I
have to use either a <p> or a double <br> to push the next paragraph down a
line.
Now, I'm more confused. You're talking about "the following paragraph",
and then you say "to correct this, I have to use either a <p> ..." If you
don't have a <p>, how can you have a paragraph? Are you saying that you
have something like this:

<ol>
<li>example text</li>
<br>
Random text not part of any element.
<li>another example</li>
</ol>

That's completely invalid. How different browsers will decide what to do
with it is a complete crapshoot.
Can I get some help with these?


My recommendation would be to eliminate all of your errors first. Get
thee to a validator:

http://validator.w3.org/

After you've eliminated all of the errors that it reports, see if you
still have any problems.

--
Michael F. Stemper
#include <Standard_Disclaimer>
Life's too important to take seriously.

Jul 20 '05 #6

P: n/a
In article <mk********************************@4ax.com>, Steve Pugh writes:
<ol>
<li><span>everything</li>
</ol>
Shouldn't that be:

<ol>
<li><span>everything</span></li>
</ol>
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor


Which Doctor? Colin Baker? He had the ugliest tie.

--
Michael F. Stemper
#include <Standard_Disclaimer>
Life's too important to take seriously.

Jul 20 '05 #7

P: n/a
ms******@siemens-emis.com (Michael Stemper) wrote:
In article <mk********************************@4ax.com>, Steve Pugh writes:
<ol>
<li><span>everything</li>
</ol>


Shouldn't that be:

<ol>
<li><span>everything</span></li>
</ol>


Yes it should.
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor


Which Doctor? Colin Baker? He had the ugliest tie.


Sylvester McCoy.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #8

P: n/a
On Fri, 7 May 2004 08:01:12 -0500, Michael Stemper
<ms******@siemens-emis.com> wrote:
(I think that you
can put paragraphs into list items, but wouldn't swear to it.)


It's valid.
Jul 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.