【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さんの
おすすめ

10

/

23

2024

Googleさんの
おすすめ

10

/

23

2024

デザインの記事

AISTON
  • 2024.10.16New
  • AISTON
  • 国内、海外のウェブデザイン、パソコン・タブレット・スマートフォンでも見やすいレスポンシブ対応の「あ、いいな」と思うウェブデザインを集めています。
  • デザインのこと – Web design gallery
ルックバック
【jQuery】スライダープラグイン「slick」実装サンプル集