<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>测试</title> <style> html, body { height: 100%; margin: 0; overflow: hidden; } .container { height: calc(100% - 30px); width: calc(100% - 30px); margin: 15px; border: 1px solid red; overflow: auto; } </style> </head> <body> <div class="container"> 1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br>1<br> </div> </body> </html>
标签:body,100%,height,撑满,div,calc,30px From: https://www.cnblogs.com/kgdxpr/p/17753780.html