0

我有一个正在处理的网页,当中间没有内容时,它看起来很棒。最近,当我尝试将内容添加到中心列时,问题就出现了。我正在添加一个表格,其中包含人们必须回答的一长串问题。问题是,当此内容大于窗口大小时,它会向下滚动内容,但侧边栏保持相同大小。

我在 jsfiddle 上附上了我的代码。任何帮助,将不胜感激。:)

http://jsfiddle.net/qp5Zk/3/ 1

@charset"utf-8";
html, body {
width: 100%; /* IE6 Hacks */
height: 100%; /* IE6 Hacks */
margin: 0;
padding: 0;
}
body {
background-color: green;
background-repeat: repeat;
height: 100%;
}
#content_wrapper {
margin: 0 auto; /* Center it on the page */
width: 93%;
height: 100%;
}
#center_column {
margin: 0 14px 0 14px; /* 0 Right Column 0 Left Column */
background-color: #FFF;
height: 100%;
}
#left_column, #right_column {
width: 14px;
height: 100%;
}
#left_column {
float: left;
background-color: pink;
}
#right_column {
float: right;
background-color: orange;
}
#header_top {
width: 100%;
height: 14px;
background-color: #EEE;
}
#header_top_grad {
width: 100%;
height: 14px;
background-color: blue;
background-repeat: repeat-x;
}
#header_middle {
height: 40px;
width: 100%;
background-color: yellow;
background-repeat: repeat-x;
}
#header_bottom {
background-color: blue;
background-repeat: repeat-x;
height: 14px;
width: 100%;
}
#logo {
width: 100%;
background-color: #EEE;
}
#logo img {
width: 253px;
height: 47px;
margin: 10px 0 10px 20px;
} 
#main_table {
color: #696969;
font-size: small;
width: 90%;
margin: 0 auto;
border-spacing: 0;
border: 0; 
/* IE border-spacing workaround */
border-collapse: collapse;
}
#main_table td {
/* Padding between each question */
padding-bottom: 20px;
}
.q_column, .r_column, .e_column {
background-color: #FFF;
}
.q_column {
font-weight: bold;
text-align: right;
/* Padding between question and response column */
padding-right: 10px;
}
.red {
color: #F00;
font-size: large;
}
 .text_field {
border: 1px solid;
border-collapse: collapse;
border-color: #BBB;
color: #000;
}
.small_text {
font-size: smaller;
}
.r_column {
width: 35%;
}
.e_column {
width: 25%;
}

我没有成功尝试 clearfix,但可能做错了什么,或者它甚至可能不是正确的解决方案。

4

2 回答 2

0

@user2151158 像这样为 Content 类设置最小高度

#content_wrapper {
    margin: 0 auto; /* Center it on the page */
    width: 93%;
    min-height: 100%;
}
于 2013-03-09T09:58:49.193 回答
0

试试这个小提琴:http: //jsfiddle.net/krish/qp5Zk/7/

我将 center_coloum 更改为相对并将左右列设置为绝对更改的详细信息如下所示。

改变的CSS

    #center_column {
    margin: 0 14px 0 14px; /* 0 Right Column 0 Left Column */
    background-color: #FFF;
    height: 100%;
    position:relative; /*added*/
    }

    #left_column 
    {
    /* removed float: left; */
    background-color: pink;
    position:absolute; /*added*/
    left:0px; /*added*/
    }

    #right_column {
    /*removed float:right*/
    background-color: orange;
    position:absolute; /*added*/
    right:0px; /*added*/
    }
于 2013-03-10T12:12:55.620 回答