tags:

views:

104

answers:

3

I feel very noobish asking this, but I can't seem to figure it out... I have a standard <ol> that lists

  1. List item
  2. List item
  3. List item

etc.

In my CSS I would like to include the entire <li> in the background color, for instance (in my very best ASCII representation):

----------------
| 1. List item |  <----- box = solid background color
----------------

but I can only seem to get:

   -------------
1. | List item |
   -------------

Is there some property I'm missing? It's pretty annoying and I would like to fix it. Also, I am going to be coloring these different (odd/even) so just coloring the <ol> won't work, I don't think :\

Thanks for your help!

+3  A: 

What about setting this in the CSS

ol {
    list-style: inside decimal;
}

The 'inside' is the important bit.

alex
holy balls... i've never heard of "inside"... what is it?? ps this works pretty well... going to finish tweaking then accept
Jason
ok question... it got it inside the box, but now i can't seem to get any content on the same line as the number... it's appearing on the next line... any trick for that, mr wizard?
Jason
Haha, mr Wizard! Sounds like your list items are not wide enough now to accomodate the bullet point inside. Perhaps make them wider? If not, post a new question and I'll take a look.
alex
my items are plenty wide... actually there's no width set so they automatically span the width of the container... it's super weird
Jason
What about margins/padding? Open a new question and post your relevant HTML/CSS and I'll take a look.
alex
+2  A: 

I think what you're after is:

ol { list-style-position: inside; }
Alconja
that effectively does the same thing as alex's... how do i get the content on the same line as the number now?
Jason
Yeah, alex's wasn't there while I was typing that... The content should be on the same line as the number unless you've got some weird padding, wrapping issues going on. Might want to post your specific html/css...
Alconja
hm... may be the case. thanks.
Jason
A: 

I don't think you're going to be able to use to get the desired effect. I would recommend, divs, dl, or even a table.

bingeboy