Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unordered and ordered lists

Status
Not open for further replies.

yippiekyyay

Programmer
Oct 26, 2002
186
CA
Hello,

I need to treat ol differently than ul. Specifically, I need a space after each item in an ordered list, but no space after an item in an unordered list.

Do I have to give each <li> a class name? or can I not do something like:
ul.li {margin-bottom: 0px}
ol.li {margin-bottom: 10px}

(I know that's wrong - but I just wanted to give you an idea of what I was going for).

Thanks in advance!
-Sean
 
Sure you can. You type the space between the elements, like this:

ul li {margin-bottom: 0px}
ol li {margin-bottom: 10px}

This means every <li> under the <ul> tag will have different formatting than <li> under the <ol> tag. Maybe it is better to go with classes, so you don't change the properties of all the elements. this would look like this

.nomargin li {margin-bottom: 0px}
.margin li {margin-bottom: 10px}

Every <li> under <ul class=&quot;nomargin&quot;> will have no margin, <ul class=&quot;margin&quot;> will have margins, same goes with <ol class=&quot;margin&quot;> and <ol class=&quot;nomargin>.

Enjoy, hope it helped.
 
So it was just that I placed a &quot;.&quot; in between instead of a space?!?

Thank you Vragabond!! I especially appreciate it when people answer and offer alternative solutions - best way to learn!

Cheers!
-Sean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top