CSS two div width 50% in one line with line break in file

后端 未结 9 1247
囚心锁ツ
囚心锁ツ 2020-12-04 15:18

I try to build fluid layout using percentages as widths. Do do so i tried this:

A
9条回答
  •  情深已故
    2020-12-04 16:12

    The problem is that if you have a new line between them in the HTML, then you get a space between them when you use inline-table or inline-block

    50% + 50% + that space > 100% and that's why the second one ends up below the first one

    Solutions:

    or

    or

    The idea is not to have any kind of space between the first closing div tag and the second opening div tag in your HTML.

    PS - I would also use inline-block instead of inline-table for this

提交回复
热议问题