I reread a bunch of pages, including on stackOverflow, but did not find a solution to my problem. The fact is that with the height of html, body and .container equal to 100%, the page is cut in height, if the amount of content exceeds the height of the browser window, before there were no such problems with the same properties, please tell me what the error is. I tried a bunch of variations with the properties height, min-height, percent and vh, the problem remains. I want to achieve that when the amount of content is less than the height of the window, the elements are stretched to the height of the entire window, and when the amount is greater, there is no described problem.
Screenshot:
HTML:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <div class="container"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates in nemo molestiae itaque, eligendi dolores doloremque deleniti ipsum tempore, ducimus dolorem quia vitae incidunt at quas atque sapiente saepe aperiam veniam culpa iusto, nostrum laudantium placeat tenetur id. Enim, dolore? Nesciunt temporibus quibusdam mollitia. Possimus debitis laboriosam rerum iusto illum fugit earum, consequuntur molestias explicabo itaque magnam animi molestiae sint dolore asperiores placeat harum. Quam voluptate magnam deserunt dicta, omnis. Quo excepturi impedit ut adipisci, odit accusantium. Sequi dolores facere, neque nam, officiis pariatur harum totam minima laboriosam obcaecati. Quo soluta repellendus doloremque esse eum, quos officiis assumenda, consequatur reiciendis cum, minus repudiandae nesciunt! Aspernatur, sint ex, odit numquam ducimus architecto minus impedit quod fugiat. Explicabo rem laboriosam, inventore accusantium tempore aspernatur delectus vel eveniet deleniti id repellendus a aperiam omnis quia. Aut quidem iusto nemo natus ea eum tempora voluptate sequi voluptatum sapiente? Dolores, nam labore velit explicabo obcaecati.</p> </div> </body> </html> CSS:
html, body { margin: 0; padding: 0; height: 100%; } .container { height: 100%; background-color: teal; } p { margin: 0; padding: 0; } 