Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List with decimal numbers

Tags:

html

is it possible to have <li> numbers like this?:

1.1 First Item
1.2 Second Item
2.1 Other item
like image 766
pistacchio Avatar asked Nov 09 '10 09:11

pistacchio


People also ask

What is an example of decimal number?

"Decimal number" is often used to mean a number that uses a decimal point followed by digits that show a value smaller than one. Example: 45.6 (forty-five point six) is a decimal number.

What is decimal data type example?

The decimal data type is a machine-independent method that represents numbers of up to 32 significant digits, with valid values in the range 10 -129 - 10 +125. When you define a column with the DECIMAL( p ) data type, it has a total of p (< = 32) significant digits.


1 Answers

The proper way to do it is by using the CSS counter-increment property.
You could set sections and sub-sections as "Section 1", "1.1", "1.2", etc.
http://www.w3schools.com/cssref/pr_gen_counter-increment.asp

<style>
    ol { counter-reset: item }
    li { display: block }
    li:before { content: counters(item, ".") " "; counter-increment: item }
</style>

   <ol>
        <li>First level</li>
        <li>First level 2
            <ol>
                <li>Second level</li>
                <li>Second level 2
                    <ol><li>Third level</li></ol>
                </li>
            </ol>
        </li>           
    </ol>

Another great explanation: http://www.impressivewebs.com/css-counter-increment/

like image 51
Gal Margalit Avatar answered Sep 22 '22 13:09

Gal Margalit