Looking to centralize a main div and add a fixed menu to the right side of it. The goal is for the main div to remain centered while the right menu "sticks" to the center div.
At the moment, I've used flex
to center the div, but it has resulted in both items being centered (meaning the main div isn't truly at the center).
This is the layout I want:
https://i.sstatic.net/7Bqy5.png
Current layout:
https://i.sstatic.net/PrZze.png
The code I currently have (using React with styled components) looks like this:
Container:
const DivContainer = styled.div`
display: flex;
justify-content: center;
position: relative;
z-index: 60;
width: 100%;
`;
Main Div:
const MainDiv = styled.div`
width: 300px;
padding: 35px 15px;
`;
Menu div:
const MenuDiv = styled.div`
display: flex;
cursor: pointer;
flex-shrink: 0;
flex-direction: column;
margin-top: 85px;
order: 10;
`;
This is how it renders:
<DivContainer>
<MainDiv />
<MenuDiv />
</DivContainer>