Link to home
Start Free TrialLog in
Avatar of naifyboy123
naifyboy123Flag for Afghanistan

asked on

space between list items

this should be easy but is quite urgent

when you create a list (ul, ol etc, etc) how do you put a space netween the lines - i have tried using <br> but then my code fails html validation

for example

<ul>
<li>line one</li>
<li>line two</li>
<li>line three</li>
</ul>

how do i force a space between the lines whilst keeping my code vaild? - i need a solution that will work in IE, Netscape and Firefox.

thanks
SOLUTION
Avatar of DBB
DBB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of naifyboy123

ASKER

ooops i forgot to mention that sone of my list lines run accross 2 lines of the page and that fix means i get a space on all lines:

<ul>
<li>this line is long and actually spans 2 lines on the page before the next list item is shown and therefore the second line of the list shows a space which i dont want</li>
<li>this line is normal and only spane one line of the page</li>
<li>this line is alo slong blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah</li>
<li>and this line only spans one line as well</li></ul>

sorry - is there a way i can only make the list "items" have the space between them rather than a space on every line regardless?


yes, by using margin-bottom

example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
      <title>Test</title>
      <style type="text/css">
      li{
            margin-bottom:10px;
      }
      </style>
</head>
<body>

<ul>
<li>this line is long and actually spans 2 lines on the page before the next list item is shown and therefore the second line of the list shows a space which i dont want</li>
<li>this line is normal and only spane one line of the page</li>
<li>this line is alo slong blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah</li>
<li>and this line only spans one line as well</li></ul>

</body>
</html>
sorry shoud have refreshed before posting - thank batalf
Glad I could help!

Batalf