Input
Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CSS calc() Example</title> <style> /* Fixed header style */ header { background-color: #3498db; color: white; height: 50px; text-align: center; line-height: 50px; /* Center the text vertically */ } /* Section style that takes full height minus the header height */ section { background-color: #2ecc71; height: calc(100vh - 50px); /* Full height minus header height */ padding: 20px; color: white; } /* Simple content style */ h2 { font-size: 24px; text-align: center; } </style> </head> <body> <header> My Header </header> <section> <h2>Content that takes full screen height minus the header</h2> <p>This section uses the CSS calc() function to adjust its height based on the viewport height, accounting for the fixed header.</p> </section> </body> </html>