Skip to content

Instantly share code, notes, and snippets.

@mojavelinux
Last active December 7, 2020 10:41
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 mojavelinux/10078846ecc2772112420c7293c3d0ca to your computer and use it in GitHub Desktop.
Save mojavelinux/10078846ecc2772112420c7293c3d0ca to your computer and use it in GitHub Desktop.
Flexbox alignment challenge: How do we get the green boxes to be flush with the right margin while keeping the wrap behavior the same?
<!DOCTYPE html>
<html>
<head>
<style>
.container {
border: 3px solid blue;
width: 250px;
display: flex;
justify-content: space-between;
}
.left {
flex: none;
padding: 0.2em 0;
}
.right {
display: flex;
flex-wrap: wrap;
margin-top: -0.5em;
}
.box {
background-color: green;
color: white;
margin: 0.5em 0 0 0.5em;
padding: 0.2em;
}
</style>
</head>
<body>
<div class="container">
<div class="left">
<span>Project Name</span>
</div>
<div class="right">
<span class="box">1.0</span>
<span class="box">2.0</span>
<span class="box">3.0</span>
<span class="box">4.0</span>
<span class="box">5.0</span>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment