Nicolas
Nicolas

Reputation: 2367

HTML List Text indentation after number

how can I increase the margin between the numeral and the text in an ordered list?

i.e.

<ol>
  <li>text 1</li>
  <li>text 2</li>
  <li>text 3</li>
</ol>

Produces

  1. text 1
  2. text 2
  3. text 3

And I want

  1. __ text 1
  2. __ text 2
  3. __ text 3

Where __ is an arbitrary indentation.

Upvotes: 0

Views: 1524

Answers (2)

Nicolas
Nicolas

Reputation: 2367

Found the answer here

I modified the fiddle to work for what I needed.

ol {
    counter-reset: item;
    margin-left: 0;
    padding-left: 0;
}
li {
    display: block;
    margin-bottom: .5em;
    margin-left: 2em;
}

li:before {
    display: inline-block;
    content: counter(item) ".";
    counter-increment: item;
    width: 2em;
    margin-left: -2em;
}

Upvotes: 1

maiorano84
maiorano84

Reputation: 11971

<ol>
<li><span class="indent">text 1</span></li>
<li><span class="indent">text 2</span></li>
<li><span class="indent">text 3</span></li>
</ol>
<style="text/css">
ol li .indent{padding-left:20px;}
</style>

Upvotes: 2

Related Questions