*{
height: 200px;
width: 500px;
}
#flex-container{
display: flex;
border: 1px solid black;
padding: 10px;
}
#flex-container p{
justify-content:flex-end; /* moves text over to the right */
align-items:flex-end; /* moves text to the bottom */
}
#flex-item-left{
margin: 0 5px;
border: 1px solid black;
}
#flex-item-middle{
margin: 0 5px;
border: 1px solid black;
}
#flex-item-right{
margin: 0 5px;
border: 1px solid black;
}
The only problem is I do not know how to position the text
div=“flex-container”
at the bottom center just like the picture from the very top. What I did understood is that the justify-content is responsible for moving flex items horizontically while the align-items is for moving items vertically. Can anyone help me with this?
Hello, thank you for answering. Sorry for this but my question was about how to make the p element position at the bottom center (just like in the pic of what I’m trying to imitate).
This is what my html looks like overall from the code above:
And this is what I came up with trying to position the p element to the bottom center but for a reason that I don’t know yet, it does not work. Can anyone enlighten me about this?
#flex-container p{
justify-content:flex-end; /* moves text over to the right */
align-items:flex-end; /* moves text to the bottom */
}
Your p is a box. It is the first box in your flex container.
You can’t use justify-content or align-items on child elements, just on the parent flex container.