0

I am using flex for aligning dynamic length of LIs. Everything is working fine but I am not sure how to align last row to left or right align while using flex's justify-content: space-between.

LIs length is dynamic and can be any of numbers e.g. 8, 9, 10... etc.

Shyam
  • 782
  • 5
  • 12
  • JSBIN: https://jsbin.com/xeqeloheme/edit?html,css,output – Shyam Jan 24 '20 at 05:12
  • Use `ul::after { content: ""; flex: auto;}` – Fanky Feb 26 '20 at 18:26
  • @Fanky, I am surprised how it is working! Thanks, as it can be a hack if we have fixed items. For dynamic elements it is also aligning last row if we have 3 elements in last row. Even if there are only 2 items in last row I would like to have equal margin b/w them as in earlier row elements :) – Shyam Feb 27 '20 at 09:59
  • not sure I understand, but with this hack, you should have no margins of `li` to left and right, rather wrap the content like `
  • content
  • ` and use padding on `li`. I've created a fiddle in [my answer](https://stackoverflow.com/a/60420485/2095642) to the "duplicate" question – Fanky Feb 27 '20 at 14:56