How to align dt and dd side-by-side using flexbox with multiple dd underneath the other?

后端 未结 3 1823
一向
一向 2020-12-03 14:24

I am trying to create a list consisting of key-value-pairs where the key is on the left and the values are on the right side one underneath the other.

Author         


        
3条回答
  •  -上瘾入骨i
    2020-12-03 14:58

    It's been a few years since this was posted but there is definitely a better way to handle this today using display: grid:

    dl {
      display: grid;
      grid-template-columns: 33% auto;
    }
    
    dt {
      grid-column: 1;
    }
    
    dd {
      grid-column: 2;
    }
    Authors
    John Doe
    Jane Doe
    Max Mustermann
    Publishers
    John Doe
    Jane Doe
    Max Mustermann

提交回复
热议问题