I\'m trying to get a div that has position:fixed center aligned on my page.
I\'ve always been able to do it with absolutely positioned divs using this \
You could use flexbox for this as well.
.wrapper {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
/* this is what centers your element in the fixed wrapper*/
display: flex;
flex-flow: column nowrap;
justify-content: center; /* aligns on vertical for column */
align-items: center; /* aligns on horizontal for column */
/* just for styling to see the limits */
border: 2px dashed red;
box-sizing: border-box;
}
.element {
width: 200px;
height: 80px;
/* Just for styling */
background-color: lightyellow;
border: 2px dashed purple;
}
Your element