Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1675

Vertical align and center of container using flex-box [duplicate]

$
0
0

How to fit only one item in the center of the container using flex-box?
I can use the justify-content, but it works for all items.
I need to apply justify-content only in one item, probably using flex-wrap.
But I want both items vertical aligned.It can be achieved using align-items.

How can I fit one item in the center of the container and vertical align the items?

enter image description here

I can align my text vertically, but I couldn't show my item in the center of the container (horizontally).

<!DOCTYPE html><html><head><style>body {  background-color: black;}</style></head><body><div style="border: 2px solid powderblue;padding:130px;background-color:orange;display:flex;flex-direction:row;"><div style="border:2px solid pink;padding:30px;vertical-align:middle;"><</div><div style="border:2px solid gray;padding:30px;vertical-align:middle;">    center</div></div></body></html>

enter image description here

I want this:

enter image description here


Viewing all articles
Browse latest Browse all 1675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>