侧菜单div高度不随主div延伸

时间:2012-08-10 23:47:56

标签: css html

我有一个.page <div>,它围绕着里面的所有内容。当内容延伸时,.page <div>

也会延伸

我的主要问题是.leftBannerBackground <div>没有使用.page <div>扩展。

我能做些什么来使.leftBannerBackground <div>的高度延伸到.page <div>

HTML的简短版本:

    <div class="page">
        <div class="header">
            <div class="top_banner">
            </div>
            <div class="title">
                <h1 class="siteColor centeredText">
Header                </h1>
            </div>
        </div>
        <div class="leftBanner">
        </div>
        <div class="leftBannerBackground">

        </div>



        <div class="main">
            <!-- Content goes here -->
          <div class="leftSide">


          </div>

            <div class="rightSide" style="margin-top: 35px;"></div>


        </div>
        <div class="bottomFiller"></div>


        <div class="footer">

        </div>
    </div>

CSS:

    /* DEFAULTS
----------------------------------------------------------*/

body   
{
    background: #ffffff;
    font-size: .80em;
    font-family: "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif;
    /*margin: 0px;*/
    text-align:justify;
   padding: 0px;
    color: #000000;
    /*height: auto !important;
    height: 100%;
    min-height: 100%;*/
}

p
{
    margin-bottom: 10px;
    line-height: 1.2em;
}


/* HEADINGS   
----------------------------------------------------------*/

h1, h2, h3, h4, h5, h6
{
    font-size: 1.5em;
    color: #666666;
    font-variant: small-caps;
    text-transform: none;
    font-weight: 200;
    margin-bottom: 0px;
}

h1
{
    font-size: 1.6em;
    padding-bottom: 0px;
    margin-bottom: 0px;
}

h2
{
    font-size: 1.5em;
    font-weight: 600;
}

h3
{
    font-size: 1.2em;
}

h4
{
    font-size: 1.1em;
}

h5, h6
{
    font-size: 1em;
}

/* this rule styles <h1> and <h2> tags that are the 
first child of the left and right table columns */
.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2
{
    margin-top: 0px;
}


/* PRIMARY LAYOUT ELEMENTS   
----------------------------------------------------------*/

.page
{
    width: 960px;
    background-color: #fff;
    /* margin: 20px auto 0px auto;*/
    border: 1px solid #496077;
    position: absolute;
    top: 20px;
    left: 50%;
    margin-left: -480px;





}

.header
{
    position: relative;
    margin: 0px;
    padding: 0px;
    background: #FFFFFF;
    width: 100%;
}

.header h1
{
    font-weight: 700;
    margin: 0px;
    padding: 0px 0px 0px 20px;
    color: #f9f9f9;
    border: none;
    line-height: 2em;
    font-size: 2em;
}

.main
{
    position:relative;
    padding: 4px 12px 8px 6px;
    margin: 220px 0px 0px 150px;
    width: 790px;
    min-height:390px;
    top: 10px;
    overflow: auto;

}

.bottomFiller
{
    min-height: 0px;
}

.leftCol
{
    padding: 6px 0px;
    margin: 12px 8px 8px 8px;
    width: 200px;
    min-height: 200px;
}

.footer
{
    position: relative;
    color: #ffffff;
    padding: 8px 0px 0px 0px;
    margin: 0px auto;
    text-align: center;
    line-height: normal;
    background-color: #9B0707;
    min-height: 20px;
    /*margin-bottom: 40px;*/
}

.partners
{
    position: relative;
    width: 126px;
    height: 46px;
    bottom: 20px;
    z-index:6800;
}


/* TAB MENU   
----------------------------------------------------------*/

div.hideSkiplink
{
    width:100%;
}

div.menu
{
    position: relative;
    padding: 0px 0px 0px 16px;
    margin-top: 275px;
    margin-bottom: 0%;

    height: 100%;
    /*top: 200px;
    margin: 275px 0px;*/
}



div.menu ul li a, div.menu ul li a:visited
{
    color: #FCE756;  /* text color */
    font-size:medium;
    display: block;
    list-style: none;
    line-height: 1.95em;
    padding: 4px 5px;
    text-decoration: none;
    white-space: nowrap;
}

div.menu ul li a:hover
{
    color: #ffffff;
    text-decoration: none;
}



/* FORM ELEMENTS   
----------------------------------------------------------*/

fieldset
{
    margin: 1em 0px;
    padding: 1em;
    border: 1px solid #ccc;
}

fieldset p 
{
    margin: 2px 12px 10px 10px;
}

fieldset.login label, fieldset.register label, fieldset.changePassword label
{
    display: block;
}

fieldset label.inline 
{
    display: inline;
}

legend 
{
    font-size: 1.1em;
    font-weight: 600;
    padding: 2px 4px 8px 4px;
}

input.textEntry 
{
    width: 320px;
    border: 1px solid #ccc;
}

input.passwordEntry 
{
    width: 320px;
    border: 1px solid #ccc;
}

div.accountInfo
{
    width: 42%;
}

/* MISC  
----------------------------------------------------------*/

.siteColor
{
    color: #9B0707 !important;
}

.centeredText
{
    text-align: center;
}

.clear
{
    clear: both;
}

.leftBannerSpaceFiller
{
    position: relative;
    float:left;
    background-color:#9B0707;
    height: 100%;
    width:132px;
}

.title
{
    display: block;
    float: right;
    text-align: left;
    right: 250px;
    width: auto;
    position: absolute;
    margin-top: 8px;
}

.top_banner
{
    background-image: url('../Images/topBanner.png');
    top: 66px;
    left:50px;
    height: 164px;
    width: 911px;
    position: absolute;
    z-index: 6900;
}

.leftSide {
float:left;
width:468px;
}
.leftSidecont {
float:left;
width:790px;
}
.leftSideteam {
float:left;
width:540px;
}
.leftSideliens {
float:left;
width:268px;
}
.rightSide {
float:right;
width:300px;
}
.rightSidecont {
position: absolute;
width:400px;
}
.rightSideteam {
float:right;
width:228px;
}
.rightSideliens {
float:right;
width:500px;
}

.leftBanner
{
    background-image: url('../Images/leftBanner.png');
    height: 592px;
    width: 52px;
    margin-top: 30px;
    position: absolute;
    z-index: 3600;
}

.leftBannerBackground
{
    position:relative;
    background-color: #9B0707; /* #a40a0a; */
    width:132px;
    z-index: 1600;
    float:left;
    height: 100%;
    margin-bottom: 0%;



}

.loginDisplay
{
    font-size: 1.1em;
    display: block;
    text-align: right;
    padding: 10px;
    color: White;
}

.bold
{
    font-weight: bold;
}

1 个答案:

答案 0 :(得分:0)

您有两种选择:

  1. 在.leftBannerBackground上使用绝对定位并设置top: 0px;bottom: 0px;。演示:http://jsfiddle.net/ZXLNk/
  2. 在.leftBannerBackground上使用height: 100%;(就像你一样)。但为了实现这一点,您还需要将所有包含元素的高度设置为100%:.page,<body><html>。当然这也意味着你将无法在.page上使用绝对定位。演示:http://jsfiddle.net/gLzcK/