Hello so I am trying to make a div appear when an element has been toggled. The function and events definitely work because if I remove the styling then the element appears but when I add it, it has disappeared and I actually have no idea why. It disappears when I add position:absolute
but even when I put the height and width to 100% and it doesn't follow. Here is my Sandbox.
Here is my css:
* {
box-sizing: border-box;
}
html,
body,
#root {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow: hidden;
user-select: none;
background: lightblue;
}
.Main {
height: 100%;
width: 100%;
position: abosolute;
}
.Contain {
border-radius: 50%;
box-shadow: 50px rgba(0, 0, 0, 0.05);
position: absolute;
height: 50px;
width: 50px;
padding-left: 20px;
margin-bottom: 20px;
z-index: 998;
cursor: pointer;
}
.Contain p {
color: white;
}
.Item {
width: 100%;
height: 100%;
background: white;
border-radius: 5px 30px 30px 5px;
will-change: transform, opacity;
position: absolute;
display: inline-block;
bottom: 0.1%;
box-shadow: 50px rgba(0, 0, 0, 0.05);
}
.Item p {
color: black;
}
.Buttons {
top: 20%;
left: 25%;
z-index: 998;
position: absolute;
}
.Overlay {
background-color: #282c34;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
box-shadow: 0px 10px 10px -5px rgba(0, 0, 0, 0.05);
z-index: 999;
position: absolute;
}
I would post the JSX but they're in different pages and it is probably easier to see the sandbox
Thank you!
So I figured out that what was causing issues with my style was my <a.div>
around my overlay component that reduced the styling. So I made the styling for the div to be position: 'sticky'
and top:0
and width and height to 100%.
Any children of another div would be styled in relative to fit the parent div so the parent div must be styled accordingly