Dùng position: absolute kết hợp top, bottom, width: 100%. Không cần height % hay jQuery.
.mainbody {
position: absolute;
top: 30px; /* Header height */
bottom: 10px; /* Footer height */
width: 100%;
}
Div sẽ tự co giãn chiều cao giữa header và footer.