CSS to line break before/after a particular `inline-block` item

后端 未结 9 1622
再見小時候
再見小時候 2020-11-27 09:36

Let\'s say I have this HTML:

Features

  • Smells Good
  • <
9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 10:30

    I accomplished this by creating a ::before selector for the first inline element in the row, and making that selector a block with a top or bottom margin to separate rows a little bit.

    .1st_item::before
    {
      content:"";
      display:block;
      margin-top: 5px;
    }
    
    .1st_item
    {
      color:orange;
      font-weight: bold;
      margin-right: 1em;
    }
    
    .2nd_item
    {
      color: blue;
    }
    

提交回复
热议问题