Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
试图根据窗口大小获得 100% 的高度。
<script> $(document).ready(function(){ var contHeight = $(window).height(); $('#container').css("height",contHeight + "px"); }); </script>
工作小提琴
http://jsfiddle.net/mzpa4/
您也可以尝试:
$(window).on('load resize',function(){ var contHeight = $(window).height(); $('#container').css("height",contHeight + "px"); });
这样即使用户调整窗口大小,高度也会保持在窗口高度,正如@adeneo 建议的那样
http://jsfiddle.net/mzpa4/3/show/