How to align two columns of text in CSS

后端 未结 2 1165
情歌与酒
情歌与酒 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:14

    As per my comment, I think the best element for the job is an ordered list.

    ol {
       font-family: georgia, serif;
       font-size: 16px;
       font-weight: bold;
    }
    ol li span {
       font-family: arial, sans-serif;
       font-weight: normal;
       font-size: 12px;
    }
    1. Entry one
      text on another line
    2. Entry two
    3. Entry three
    4. Entry five
    5. Entry six

    With the span to allow changing of font-family between the list "bullets" and the content within, these could be divs if you have block content.

提交回复
热议问题