如何链接两个液柱,以便在内容div增加时导航div高度增加

时间:2013-10-31 07:56:17

标签: css html

如何链接两个液柱,以便在内容div增加时导航div高度增加。

实施例

向左浮动2个div。(彼此并排)1。nav div 2. content div

由于文本增加,内容div会逐渐扩展,我希望导航div也可以在高度上扩展。导航和内容div的底部与页脚div齐平。

这是当前的代码。

<div id="nav">
    <ul>
      <li><a href="index6.html">Home</a></li>
    <li><a href="#">Menu</a></li>
    <li><a href="music6.html">Music</a></li>
    <li><a href="jobs6.html">Jobs</a></li>
    <li>&nbsp;</li>
    <li><a href="best-practices6.html">Best Practices</a></li>
    <li></li>
    </ul>
  </div>
  <div id="content">
    <h3>Text</h3>
    <blockquote>
      <p>Text</p>
    </blockquote>
    <h3>Text</h3>
    <blockquote>
      <p>Text<br/>
        Text</p>
    </blockquote>
    <h3>Text</h3>
    <blockquote>
      <p>Text</p>
    </blockquote>
  </div>
  <footer>&nbsp;Copyright &copy; Text<br />
    &nbsp;<a href="mailto:Text>Text</a></footer>
</div>

CSS

body {
    font-family: Veranda, Arial;
    color: #330000;
    background-color: #ffffcc;
    -webkit-box-shadow: 0px 0px;
    box-shadow: 0px 0px;
    background-image: url(../javajam6html5/images6/background6.gif);
}

#wrapper {
    width: 80%;
    margin-right: auto;
    margin-left: auto;
    min-width: 700px;
    background-color: #F2EAB7;
    -webkit-box-shadow: 5px 5px 20px 5px #000000;
    box-shadow: 5px 5px 20px 5px #000000;
}

header {
    background-color: #CA6;
    width: auto;
    text-align: center;
}
nav {
    width: 150px;
    /* [disabled]padding-right: 0px; */
    /* [disabled]padding-left: 0px; */
    background-color: #FFC;
    height: auto;
    margin-bottom: 0px;
    padding-top: 10px;
    text-align: center;
    display: inline;
    float: left;
}
#content {
    height: auto;
    color: #000000;
    background-color: #f2eab7;
    padding-top: 10px;
    padding-right: 20px;
    padding-left: 20px;
    padding-bottom: 30px;
    float: left;
    position: static;
}
footer {
    font-size: .6em;
    font-style: italic;
    color: #000000;
    background-color: #ccaa66;
    text-align: center;
    width: auto;
    clear: both;
    padding-top: 20px;
    padding-right: 10px;
    padding-left: 10px;
    padding-bottom: 20px;
    height: auto;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
}

1 个答案:

答案 0 :(得分:0)

试试这个:

HTML:

<div class="table">
    <div id="nav" class="cell">
        <ul>....
    </div>
    <div id="content" class="cell">
        <h3>Text</h3>.....
    </div>
</div>

CSS:

.table{display:table-row;}
.cell{display:table-cell;vertical-align:top;}

fiddle here.