Recently delving into the world of reactjs
, I find myself facing a challenge with a page that contains 3
distinct blocks formed by divs
.
Have a look at the layout on my page: My Page
This is the code snippet I have worked on:
return (
<div>
{/* First Block */}
<div style={{ padding: "0.8%", backgroundColor:"red" }}>
Block 1
</div>
{/* Second Block */}
<div style={{ height: "40%", overflowY: 'scroll', backgroundColor: "aqua", position: "fixed", width: "100%" }} >
Block 2
</div>
{/* Third Block */}
<div style={{ display: "flex", position: "fixed", bottom: 0, right: 0, left: 0, height: "40px", backgroundColor: "grey", }}>
Block3
</div>
</div>
);
Block 1
acts as the header block, while Block 2
serves as the content block and Block 3
functions as the footer block. I successfully managed to fix Block 1
at the top and Block 3
at the bottom. My current dilemma revolves around getting Block 2
to fit seamlessly in the middle with full-height responsiveness across various screen sizes. Although I tried setting manual heights for Block 2, adapting it to different screen sizes proved to be cumbersome. After seeking guidance from Stackoverflow without much success, I'm reaching out here for potential solutions.
The desired output appearance I am striving for can be viewed here: Output Screen