ในมาร์กอัปที่แสดงด้านล่างฉันพยายามทำให้ div เนื้อหายืดออกไปจนถึงด้านล่างของหน้า แต่จะยืดออกก็ต่อเมื่อมีเนื้อหาที่จะแสดง เหตุผลที่ฉันต้องการทำเช่นนี้ก็คือเส้นขอบแนวตั้งยังคงปรากฏอยู่บนหน้าแม้ว่าจะไม่มีเนื้อหาใด ๆ ที่จะแสดง
นี่คือHTMLของฉัน:
<body>
    <form id="form1">
    <div id="header">
        <a title="Home" href="index.html" />
    </div>
    <div id="menuwrapper">
        <div id="menu">
        </div>
    </div>
    <div id="content">
    </div>
และCSSของฉัน:
body {
    font-family: Trebuchet MS, Verdana, MS Sans Serif;
    font-size:0.9em;
    margin:0;
    padding:0;
}
div#header {
    width: 100%;
    height: 100px;
}
#header a {
    background-position: 100px 30px;
    background: transparent url(site-style-images/sitelogo.jpg) no-repeat fixed 100px 30px;
    height: 80px;
    display: block;
}
#header, #menuwrapper {
    background-repeat: repeat;
    background-image: url(site-style-images/darkblue_background_color.jpg);
}
#menu #menuwrapper {
    height:25px;
}
div#menuwrapper {
    width:100%
}
#menu, #content {
    width:1024px;
    margin: 0 auto;
}
div#menu {
    height: 25px;
    background-color:#50657a;
}