<li> in Netscape and Non IE browsers


On our website, when validating forms we display all the errors to the user one after the other using

<li>This is error one</li><br>
<li>This is error two</li><br>

we dont put the normal <ul> </ul> tags around the <li> tags as we dont want the lines to indent. This all works fine in IE, and the spacing between one line and the next is just the normal spacing for a <br>. However in netscape it appears like 2 <br> tags have been put it as the spacing between the two lines is massive.

Does anyone know how to get round this as this makes the pages look useless....

Thanks in advance

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

First off, your page is invalid HTML if you have <li> tags that aren't within some form of list.  This is the reason that Netscape has trouble with it.

To achieve the effect you desire, you need to create the list properly, and then apply style sheeting to sort the formatting out.  I can't remember off hand which one of the box attributes you need to set to be zero in order to stop the indenting, so I've included both.  You probably only need one of them.

<ul style="margin-left: 0px; padding-left: 0px">
<li>Item 1</li>
<li>Item 2</li>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you just remove the <br> tags you should find that there are no longer the extra spaces between the lines.
>>we dont want the lines to indent.

If you set the margin's on the list items as noted above - the visual result is:

This is error one
This is error two

At that point, then you may as well use the following to code the errors:

This is error one<br>
This is error two<br>

However, if the intent is to show the bullet's next to the list items, "but not have the normal indent of the bullets", than you need to adjust the margin property to suit your specific application:

<ul style="margin-left: 10px;">
<li>Item 1</li>
<li>Item 2</li>

This gives you the bullets but without the normal indent.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Yep, that's true - hadn't actually ever tried it, was running on a bit of guesswork from the spec!
...Most of the spec's are guesswork themselves as well... it's still hit and miss :-)
higgsyAuthor Commented:
This doesnt seem to run true actually

ive noticed that margin-left is ignored by netscape, and padding-left is ignored by IE....

so what ive done is the following :

<ul style="padding-left: 10px; margin-left: 10px;">

it seems to work fine then in both browsers.......can anyone see any problem with this code???


Sorry, I missed your netscape comment... if you're targetting both browsers, than you need both attributes. (There's a lot of discussion pertaining to whether Netscape is confused on this - but that's the only solution at this point...)
Here's an article you might find useful:

You don't need the <li>


<span>&bull; item one</span><br />
<span>&bull; item two</span><br />

Displays the way you want in both browsers and it is valid HTML.  If you are going to try to solve a problem by hacking non-standard code; you cannot expect anything but IE to support the hack.

> <span>&bull; item one</span><br />
> <span>&bull; item two</span><br />

> Displays the way you want in both browsers and it is valid HTML.

And it is also absolutely meaningless. HTML is a *structural* language. If your intent is for a set of items to be a list, use the proper HTML for a list structure, then style its appearance afterwards.

Too begin with HTML is neither structural nor a language.  It is simple markup.  Any structure is at a document level and is dependent on interpretations of the DTD (specified of defaulted).

Based on the question higgsy is interested in the rendered presentation, not requirements of a list or the properties of a list.  Thus the application of a non-standard approach the is not cross-broswer compatible.  The solution of creating a correct structure with the UL is tecnically correct, but requires addition code.

Using spans satifies the rendering requirement, resolves cross-browser issues and is standards compliant.  So are you saying that this is not a solution because it must be solved with a valid list structure; or are you saying that you don't like span used in such circumstances?

If the objective is academic purity, then there are very few solutions available for the common probelms of web development.


The magin and padding attributes should render the same in current browser with a valid DOCTYPE, but you may find differences in rendering  between IE5, IE5.5, IE 6 (quircky mode) and IE 6(compliant mode).

Early builds of Netscrap 6, and Mozilla prior to version 1.3, may not render the tpadding correctly.  However, the differences for these earlier browsers is not worth any extra effort, and you should use what ever meets your needs for the browsers and browser versions you have to support.

> HTML is neither structural nor a language.

You're wrong on the first count, and splitting hairs on the other. HTML is structural markup. It is not and was never intended to be used as a presentation language. And no, it's not a programming language, but it is a language. And if it is so simple, why do so many people appear not to be able to use it correctly?

> Any structure is at a document level and is dependent on interpretations of the DTD (specified of defaulted).

That's a ridiculous thing to say. It is not untrue, but it's misleading as hell -- you're attempting to provide an excuse to perpetuate the authoring of tag soup, rather than meaningful documents. Data has no meaning outside of its structure, so to speak of markup divorced from a DTD (even if it's only implied) or schema is a waste of time.

The importance of authoring well-structured documents becomes apparent when we consider non-PC devices and trying to extract semantically useful information from tag soup.

<span> has no use other than for applying presentation via CSS, it is semantically null, and this task can almost always be dome better by using meaningful inline elements (<strong>, <em>, etc).


is a list.


is NOT a list. It's crap. It's static.

> If the objective is academic purity, then there are very few solutions available for the common probelms of web
> development.

Dismissing me as though I'm some sort of mindless zealot does nothing towards devising such solutions. Yes, we must sometimes compromise with what's actually supported in browsers. This does not mean that we have to contribute to the death-by-white-noise of the World Wide Web while doing so.

> when validating forms we display all the errors to the user one after the other

higgsgy's stated objective here is indeed to display a *list of errors*. Therefore the optimal solution is to use an unordered list with appropriate margin/padding styles:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
  ul.errors  {margin-left:10px; padding-left:10px;}
<ul class="errors">
  <li>You screwed up this...</li>
  <li>And this...</li>
  <li>And this...</li>
  <li>And this...</li>
  <li>And this...</li>
  <li>And this...</li>

Calling a tail a leg does not make it one.
>>>Dismissing me as though I'm some sort of mindless zealot does nothing towards devising such solutions.

I'm not dismissing you as anything.  I don't see that you have sufficient standing for me to consider a debate with you.  I no longer spend much time on this site, because of this kind nonsense from "experts" who d not have a clue how the real world works on planet Earth.

Cd&, that last statement is extremely pompous, arrogant and excessively intolerant. If that's what we can expect from your remarks here in the future, perhaps you should spend even less time on the site than you currently do.
I have always posted pompous, arrogant, and intolerant comments in response to wannabes who chose to pick a fight instead of just proposing alternatives to what has already been posted.  At least I have the credentials on this site and in this TA to be arrogant about, unlike those who had to wait for the site to be dumbed down before they could compete.


Credentials mean little to me, and they certainly don't give anyone the right to be arrogant - which in my book, gives those credentials even less meaning. You seem overly pre-occupied with your standing - perhaps that's part of the problem :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.