HTML, align two elements on both sides of the same line

前端 未结 5 868
名媛妹妹
名媛妹妹 2021-01-14 06:03

Without using table, how can I align two elements (one at left, another at right) in the same line?

5条回答
  •  执念已碎
    2021-01-14 06:47

    If you want them on the same line, you can use INLINE or INLINE-BLOCK.

    #element1 {
      display: inline-block;
      margin-right: 10px;
      width: 200px;
      background-color: red;
    }
    #element2 {
      display: inline-block;
      width: 200px;
      background-color: red;
    }
    element 1 markup
    element 2 markup

提交回复
热议问题