Div boxes not aligning properly using inline-block

前端 未结 2 1742
难免孤独
难免孤独 2021-02-18 18:11

I have some very simple code which works perfect for what look I\'m trying to achieve. I have two divs which are displayed as \"boxes\" which are contained within an outer div w

2条回答
  •  佛祖请我去吃肉
    2021-02-18 18:53

    .box {
      display: inline-block;
      border: solid 1px;
      vertical-align: top;
      width: 40%;
    }

    BOX 1

    Lorem ipsum dolor sit amet, altera interesset pri an. Et aeque interpretaris vel, at quo summo deleniti disputationi. Eu inimicus splendide duo, soleat intellegam ut per. Sint impedit recusabo ex vix, aliquid adipisci consequat no ius. Eu possim consequat eum, sea cu quaeque impedit, est fuisset accusamus definiebas ad.

    BOX 2

    Viris eruditi consectetuer ei mea, eu nulla ridens officiis duo. In atomorum forensibus abhorreant quo, id nec aperiam dissentiet.

    You can use the vertical-align CSS property.

    It has effect only on inline, and inline-block elements.

    This is a great reference on vertical-align.

提交回复
热议问题