Last active
December 7, 2020 10:41
-
-
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?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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