Issue
just need a little help with this html/css code, i'm working on this little project, how can i move this green box from left to the right as it is on the images.
.container {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
margin-bottom: 50px;
}
.container2 {
border: 3px solid gray;
width: 600px;
height: 600px;
text-align: center;
display: flex;
flex-direction: column;
}
.purple {
background-color: rgb(202, 117, 202);
width: 200px;
height: 200px;
}
.green {
background-color: rgb(99, 151, 99);
width: 200px;
height: 200px;
}
.spacing {
height: 200px;
}
<div class="container">
<div class="container2">
<div class="purple">
</div>
<div class="spacing">
</div>
<div class="green">
</div>
</div>
</div>
Solution
Use align-self
.container {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
margin-bottom: 50px;
}
.container2 {
border: 3px solid gray;
width: 300px;
height: 300px;
text-align: center;
display: flex;
flex-direction: column;
}
.purple {
background-color: rgb(202, 117, 202);
width: 100px;
height: 100px;
}
.green {
background-color: rgb(99, 151, 99);
width: 100px;
height: 100px;
align-self: flex-end;
}
.spacing {
height: 100px;
}
<div class="container">
<div class="container2">
<div class="purple">
</div>
<div class="spacing">
</div>
<div class="green">
</div>
</div>
</div>
Answered By - Paulie_D
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.