Monday, 4 May 2020

How to Reorder Elements in HTML Using CSS Only

CSS is not only for styling with colours, etc, CSS can change the order of elements in HTML. The basic idea is to use 'flex' in CSS:
  • Set parent CSS
    • display:flex;
    • flex-direction:column;
  • Set child 1 CSS (order from 1)
    • order:1;
  • Set child 2 CSS
    • order:2;
  • Set child N CSS:
    • order:...

No comments:

Post a Comment