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

后端 未结 9 1254
囚心锁ツ
囚心锁ツ 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:04

    The problem is that when something is inline, every whitespace is treated as an actual space. So it will influence the width of the elements. I recommend using float or display: inline-block. (Just don't leave any whitespace between the divs).

    Here is a demo:

    div {
      background: red;
    }
    div + div {
      background: green;
    }
    A
    B

提交回复
热议问题