Skip to content

Instantly share code, notes, and snippets.

@nathansmith
Last active May 13, 2020 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathansmith/2be17178cf3c77a86e87fde64c435f68 to your computer and use it in GitHub Desktop.
Save nathansmith/2be17178cf3c77a86e87fde64c435f68 to your computer and use it in GitHub Desktop.
Example of auto layout flexbox, with reverse order
.flex-parent {
align-items: center;
display: flex;
flex-direction: row-reverse;
flex-wrap: wrap;
margin-left: auto;
margin-right: auto;
max-width: 1200px;
}
.flex-item {
flex-basis: 50%;
flex-grow: 1;
min-width: 300px;
}
<div class="flex-parent">
<figure class="flex-item">
<img
alt="Double rainbow"
src="./image.png"
/>
<figcaption>
What does it mean?
</figcaption>
</figure>
<!-- .flex-item -->
<div class="flex-item">
<p>
The image will be on the right, on desktop.
</p>
<p>
But it will stack first, for mobile width.
</p>
</div>
<!-- .flex-item -->
</div>
<!-- .flex-parent -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment