Problem:
Is it feasible to make a
Solution:
The following CSS approach consistently achieves the desired effect:
<head> <style> html, body { height: 100%; margin: 0; } #wrapper { min-height: 100%; /* This ensures the `#wrapper` is at least as tall as the viewport */ } </style> </head> <body> <div>
This solution is both straightforward and cross-browser compatible. It involves setting four CSS attributes:
The above is the detailed content of How to Make a Div Element Always Occupy the Full Screen?. For more information, please follow other related articles on the PHP Chinese website!