【CSS】Flexbox 最後の行を左寄せにする(space-between使用時)

【CSS】Flexbox 最後の行を左寄せにする(space-between使用時)

4カラムの場合。
before擬似要素、after擬似要素で空白のボックスを作る。

サンプル

See the Pen 【flexbox】justify-content: space-between / Last line, left justified by 125naroom (@125naroom) on CodePen.

サンプル NG

before擬似要素、after擬似要素がないとこうなる。

See the Pen 【flexbox】justify-content: space-between 最後の行を左寄せにする NG by 125naroom (@125naroom) on CodePen.

必要なもの

4カラムの場合。

.boxArea::before {
  content: "";
  display: block;
  width: 24%;
  order: 1;
}
.boxArea::after {
  content: "";
  display: block;
  width: 24%;
}

関連記事

Author

デザコト

あ、いいな、と思うWebデザインを紹介しています。デザインの参考に。やさしいデザインが多いです。Webデザインギャラリー『デザインのこと - Web design gallery』を運営しています。

Googleさんの
おすすめ

4

/

25

2024

Googleさんの
おすすめ

4

/

25

2024

デザインの記事

映画『わたくしどもは。』公式サイト
アオアシ
【jQuery】 ローディング、実装サンプル集