Here's a solution that is sooo close. One problem - that vertical scroll bar is there even if not needed. And it will then scroll to shift the top line up to hide its margin. Any ideas?
For the container div (which contains <p>
tag), try to set the overflow
property to auto
:
<html style="height: 100%; overflow-y: hidden;">
<body style="margin: 0; height: 100%; overflow-y: hidden;">
<div style="display: flex; flex-direction: column; height: 100%; overflow-y: hidden;">
<div style="width: 100%; background-color: blueviolet; color: white">
Hello Header!
</div>
<div style="width: 100%; background-color: dodgerblue; color: white">
Hello Navigation!
</div>
<div style="flex-grow: 1; width: 100%; overflow: auto;">
<div style="height: 100%; overflow: auto;">
<p>Four score and seven years ago our fathers brought forth, upon this continent, a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.</p>
<p>Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived, and so dedicated, can long endure. We are met on a great battle field of that war. We come to dedicate a portion of it, as a final resting place for those who died here, that the nation might live. This we may, in all propriety do.</p>
<p>But, in a larger sense, we can not dedicate we can not consecrate we can not hallow, this ground The brave men, living and dead, who struggled here, have hallowed it, far above our poor power to add or detract. The world will little note, nor long remember what we say here; while it can never forget what they did here.</p>
<p>It is rather for us, the living, we here be dedicated to the great task remaining before us that, from these honored dead we take increased devotion to that cause for which they here, gave the last full measure of devotion that we here highly resolve these dead shall not have died in vain; that the nation, shall have a new birth of freedom, and that government of the people, by the people, for the people, shall not perish from the earth.</p>
</div>
</div>
<div style="width: 100%; background-color: dodgerblue; color: white">
Hello Footer!
</div>
</div>
</body>
</html>
The output as below:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion