tags:

views:

99

answers:

3

I know in HTML you can use <ol><li></li></ol> to get a nice ordered list but doing that with list-style-type: decimal always increments the number by 1.

I'm looking for a way to set the value of the bullet text.

I might end up with a list that looks something like

12 item
22 item
 2 item

I don't want to do any crazy use of images if at all possible. Is there an easy solution for this?

I have HTML, CSS, javascript (jquery) and PHP available.

+1  A: 

SOFlow: Is it possible to specify a starting number for an ordered list with css?

Make OL list start from number different than 1 using CSS. Other than that, the only way to accomplish this is through fancy positioning. This is one of those things I wish they hadn't deprecated.

Jonathan Sampson
From your link I tried adding style="counter-reset: item ##;" to the `<ol>` but that didn't do the trick. I found the start="##" and that works...except that it's deprecated :-(
Jason
Like I said, I wish they hadn't deprecated it :)
Jonathan Sampson
A: 

That isn't really an ordered list then is it? You should just emulate a bullet in an unordered list:

<ul>
  <li><span>22</span> item
</ul>

Remove the bullet with list-style-type: none then style to taste.

SpliFF
Yes, you're right....I'm switching your <span> for a <div> and doing a little aligning so I can get the bullets right justified and the text left justified. Thanks.
Jason
+1  A: 

The following should do the trick. However, be aware that value is a deprecated attribute for the li tag in HTML 4.

<ol>
<li value="12">item</li>
<li value="22">item</li>
<li value="2">item</li>
</ol>
dave
Why's all the useful stuff deprecated :-(
Jason
value attribute is deprecated
Rony
The value attribute is not deprecated anymore in HTML5: http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-li-element
Ms2ger