How to align two columns of text in CSS

后端 未结 2 1208
情歌与酒
情歌与酒 2021-01-23 03:45

I\'m having some trouble lining up some text. I need two columns, one with numbers and one with text, like so:

1 Entry one
2 Entry two
3 Entry three
4 Entry

2条回答
  •  情书的邮戳
    2021-01-23 04:32

    You should just use an appropriately styled ol element, something like this:

    See: http://jsfiddle.net/tPjQR/

    If you want to have different styles on the number versus the list content, you'll need to wrap the content of each li in something like a span. There just isn't a better way.

    ol {
        font-family: Georgia, serif;
    }
    ol span {
        font-family: Arial, sans-serif;
        font-size: 17px
    }
    
    1. Entry one
    2. Entry two
    3. Entry three
    4. Entry five
    5. Entry six
    6. Entry Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long

提交回复
热议问题