将列设置为页面的全高 [英] Set column to full height of the page

查看:238
本文介绍了将列设置为页面的全高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在CSS中创建一个页面高度为100%的列.具体来说,左列具有背景透明性.

I'm attempting to create a column in css that is 100% height of the page. Specificially the left column with the background transparency.

我试图使contain使用overflow:隐藏,但是似乎不起作用.我知道我没有正确地解决该问题,而且我认为页眉和页脚使这些列弄乱了.

I've tried to make the contain use the overflow: hidden, but it doesn't seem to be working. I know I'm targeting the issue incorrectly and and I think that the header and footer are messing the columns up.

推荐答案

您可以在页面加载时使用javascript(在这种情况下使用jQuery)设置高度:

You could set the height with javascript ( using jQuery in this case) at page load :

$(function () {

 $('.left_col').height($(document).height());

});

以防万一用户调整窗口大小:

and just in case the user resizes the window :

$(window).resize( function () {

 $('.left_col').height($(document).height());

});

这篇关于将列设置为页面的全高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆