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

Why is flex align not centering the div? [duplicate]

$
0
0

I want to figure out what went wrong with the following code when trying to center my div horizontally and vertically. I tried justify-content and align-items. It stays stuck at the top.

.bodycontainer{    display: flex;    justify-content: center;    align-items: center;    height: 100%; }.container{    width: 50%;    height: 50%;    display: flex;    border: 1px solid #000000;}
<html><body><div class="bodycontainer"><div class="container"></div></div></body></html>

Viewing all articles
Browse latest Browse all 1675

Trending Articles



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