Breaking to a new line with inline-block?

前端 未结 8 806
梦如初夏
梦如初夏 2021-01-30 15:45

I want to remove the
\'s and do the break lines through CSS. If I change the spans to display:block the width will go 100% and I need the w

8条回答
  •  遇见更好的自我
    2021-01-30 16:13

    I think the best way to do this as of 2018 is to use flexbox.

    .text {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
    }
    /* same as original below */
    .text span {
       background:rgba(165, 220, 79, 0.8);
       display:inline-block;
       padding:7px 10px;
       color:white;
    }
    .fullscreen .large {  font-size:80px }

    We build the Internet

提交回复
热议问题