複数のdivタグを並べて表示したい。4 つの div を表示すると、各 div の幅は 25% になります。4x25% + 4 x 20px = 100% + 80px であるため、20px の各 div に左マージンを追加すると、レイアウトの改行が発生します。それはうまくいきません。
box-sizing プロパティは余白を考慮しません。
私が今できることは、各 div の幅を 16% (合計で 80%) にし、すべての div に margin-left:5% (合計で 20%) を設定して、合計で 100% にすることです。それはうまくいくはずです。
しかし、より良い方法はありませんか?div 間のギャップを固定したいだけです。