I use the code like these to create a css triangle, but to center it inside its container turns out to be difficult.
.arrow-down {
display: inline-block;
border-top: 4px solid #838990;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
}
The container div is a square with width/height set. BUT it does not use flexbox. If I can use flexbox then align-items: center; justify-content: center;
can do the trick but without flexbox it is hard.
For example margin: auto;
or left:50%
won't do it. But strangely setting position: absolute; left:50%; top:50%;
can center it vertically. Not sure why it can only do it vertically.
----- update -----
From the answer I got, add transform: translate(-50%,-50%);
do the trick, but why ?