<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> html,body{ height:100%; } body{ margin:0; padding:0; } .container{ width:100%; height:100%; background-color:red; } .div1{ width:100%; height:50px; background-color:yellow; } .div2{ width:100%; position:absolute; top:50px; bottom:0; overflow:hidden; } .div_area{ resize:none; width:100%; height:100%; border:none; padding:0; } </style> </head> <body> <!-- 需求:一个div由两部分组成div1和div2,div刚好撑满整个页面,无滚动条 div1固定高度50px, div2自适应 --> <div class='container'> <div class="div1"></div> <div class="div2"><textarea class="div_area"></textarea></div> </div> </body> </html>