tags:

views:

39

answers:

2

how I can formate my text displayed in HTML like these:

1.1 cdashjkfhkdvfsdfjkvnjk
    cnzxjkvnkncjkvjkxcvbkcbvk
1.2 cnzxjknvjn jvnxcjkcxcx
    klczxkcnzxnclnxknckxnk
1.3 ....

and not like these:

       1.  cdashjkfhkdvfsdfjkvnjk cnzxjkvnkncjkvjkxcvbkcbvk cnzxjkvnkncjkvjkxcvbkcbvk 
cnzxjkvnkncjkvjkxcvbkcbvk cnzxjkvnkncjkvjkxcvbkcbvk cnzxjkvnkncjkvjkxcvbkcbvk cnzxjkvnkncjkvjkxcvbkcbvk
       2. cdashjkfhkdvfsdfjkvnjk cnzxjkvnkncjkvjkxcvbkcbvk

Any ideas????

+2  A: 

Use an ordered list.

<ol>
    <li>cdashjkfhkdvfsdfjkvnjk cnzxjkvnkncjkvjkxcvbkcbvk </li>
    <li>cdashjkfhkdvfsdfjkvnjk cnzxjkvnkncjkvjkxcvbkcbvk </li>
</ol>

Edit:

If you don't care about IE6 the following will work =P

body {
    counter-reset:subsection;
}
ol {
    counter-reset:section;
    counter-increment:section;

}
li:before {
    counter-increment:subsection;
    content:counter(section) "." counter(subsection) " ";
}
​

Output: http://jsfiddle.net/cSWBp/

Russell Dias
Ahh just saw your edit... well lack of formatting rather.
Russell Dias
The paragraph number are in double and the text is separedet from the number
Haroldis
oops wrong JsFiddle. Check now.
Russell Dias
A: 

Browser's won't do decimals for you as far as I know.

You could use two ordered lists, one inside the other, and have the inner one with letters or roman numerals?

E.g.

<ol>
    <li>Part 1</li>
    <ol>
        <li>Child 1 of Part 1</li>
        <li>Child 2 of Part 1</li>
    </ol>
    <li>Part 2</li>
    <ol>
        <li>Child 1 of Part 2</li>
        <li>Child 2 of Part 2</li>
    </ol>
</ol>
diggersworld