Skip to content

Instantly share code, notes, and snippets.

@vctls
Last active December 14, 2020 09:39
Show Gist options
  • Save vctls/ad7fa52f725636ed8a24b4606e774a00 to your computer and use it in GitHub Desktop.
Save vctls/ad7fa52f725636ed8a24b4606e774a00 to your computer and use it in GitHub Desktop.
Bottom aligned divs, with the right one wrapping above the left one while sticking to bottom right.
<body>
<html lang="en">
<style type="text/css">
.container {
height: 300px;
background: darkgrey;
resize: both;
overflow: auto;
display: flex;
flex-wrap: wrap-reverse; /* Wraps from bottom right to top left. */
justify-content: space-between; /* Keeps divs right and left alignment when NOT wrapping. */
}
.bottomLeft {
background: orange;
height: 100px;
width: 500px;
}
.bottomRight {
background: purple;
height: 100px;
width: 500px;
margin-top: 100%; /* Keeps bottom alignment when wrapping. */
margin-left: auto; /* Keeps right alignment when wrapping. */
}
</style>
<body>
<div class="container">
<div class="bottomLeft"></div>
<div class="bottomRight" style=""></div>
</div>
</body>
</html>
@vctls
Copy link
Author

vctls commented Dec 14, 2020

Demo
Use bottom right handle to resize container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment