My English is not good. If I made a typo, please edit it. And i am very beginner
I want to have something like this
I want to have a fixed-div
whose width and height are controlled, but responsive and not manually, inside a responsive parent.
I want the child inside the .parent
to be reactively fixed, and that's what I tried
#parent {
position: relative;
width: 50%;
margin: 2rem auto;
background-color: orange;
padding: 1rem;
}
#middle {
position: absolute;
width: 100%;
height: 200px;
background: blue;
}
#child {
position: fixed;
width: 100%;
height: 100px;
background: red;
}
<html>
<body>
<div id="parent">
<div id="middle">
<div id="child"></div>
</div>
</div>
</body>
</html>